From 8e709291eb56839b4b5a8f5bf712a53e3ece7d80 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 19 Oct 2015 15:52:16 +0200 Subject: Add a print method for mkinmod objects --- DESCRIPTION | 2 +- NAMESPACE | 1 + NEWS.md | 2 ++ R/mkinmod.R | 16 ++++++++++++++++ man/print.mkinmod.Rd | 19 +++++++++++++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 man/print.mkinmod.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 365a325f..8aba93d1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,7 +3,7 @@ Type: Package Title: Routines for Fitting Kinetic Models with One or More State Variables to Chemical Degradation Data Version: 0.9-40.900 -Date: 2015-10-16 +Date: 2015-10-19 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), email = "jranke@uni-bremen.de"), person("Katrin", "Lindenberger", role = "ctb"), diff --git a/NAMESPACE b/NAMESPACE index cac85362..87d27717 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Export all names exportPattern(".") +S3method(print, mkinmod) S3method(plot, mkinfit) S3method(summary, mkinfit) S3method(print, summary.mkinfit) diff --git a/NEWS.md b/NEWS.md index cfaccc7a..1f0fdab7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,8 @@ - Use an index.r file to group help topics in static documentation +- Add a printing method for mkinmod objects + ## mkin 0.9-40 (2015-07-21) ### Bug fixes diff --git a/R/mkinmod.R b/R/mkinmod.R index 27716899..27b8410d 100644 --- a/R/mkinmod.R +++ b/R/mkinmod.R @@ -353,4 +353,20 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL, quiet = FALSE, verb class(model) <- "mkinmod" return(model) } + +print.mkinmod <- function(x, ...) { + cat(" model generated with\n") + cat("Use of formation fractions $use_of_ff:", x$use_of_ff, "\n") + cat("Specification $spec:\n") + for (obs in names(x$spec)) { + cat("$", obs, "\n", sep = "") + spl <- x$spec[[obs]] + cat("$type:", spl$type) + if (!is.null(spl$to)) cat(", $to: ", spl$to, ", $sink: ", spl$sink, sep = "") + if (!is.null(spl$full_name)) if (!is.na(spl$full_name)) cat(", $full_name:", spl$full_name) + cat("\n") + } + if (is.matrix(x$coefmat)) cat("Coefficient matrix $coefmat available\n") + if (!is.null(x$cf)) cat("Compiled model $cf available\n") +} # vim: set foldmethod=marker ts=2 sw=2 expandtab: diff --git a/man/print.mkinmod.Rd b/man/print.mkinmod.Rd new file mode 100644 index 00000000..fa02c1cb --- /dev/null +++ b/man/print.mkinmod.Rd @@ -0,0 +1,19 @@ +\name{print.mkinmod} +\alias{print.mkinmod} +\title{ + Print mkinmod objects +} +\description{ + Print mkinmod objects in a way that the user finds his way to get to its components. +} +\usage{ +\method{print}{mkinmod}(x, ...) +} +\arguments{ + \item{x}{ + An \code{\link{mkinmod}} object. + } + \item{\dots}{ + Not used. + } +} -- cgit v1.2.1