diff options
-rw-r--r-- | DESCRIPTION | 2 | ||||
-rw-r--r-- | NEWS.md | 2 | ||||
-rw-r--r-- | R/mkinsub.R | 6 | ||||
-rw-r--r-- | R/plot.mkinfit.R | 8 | ||||
-rw-r--r-- | build.log | 7 | ||||
-rw-r--r-- | man/mkinsub.Rd | 13 | ||||
-rw-r--r-- | man/plot.mkinfit.Rd | 3 |
7 files changed, 27 insertions, 14 deletions
diff --git a/DESCRIPTION b/DESCRIPTION index 06b212c7..365a325f 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-07-22 +Date: 2015-10-16 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), email = "jranke@uni-bremen.de"), person("Katrin", "Lindenberger", role = "ctb"), @@ -4,6 +4,8 @@ ### Minor changes +- Make it possible to specify arbitrary strings as names for the compounds in `mkinmod`, and show them in the plot + - Use an index.r file to group help topics in static documentation ## mkin 0.9-40 (2015-07-21) diff --git a/R/mkinsub.R b/R/mkinsub.R index f92af54b..99c3ea20 100644 --- a/R/mkinsub.R +++ b/R/mkinsub.R @@ -1,4 +1,4 @@ -# Copyright (C) 2014 Johannes Ranke +# Copyright (C) 2014,2015 Johannes Ranke # Portions of this code are copyright (C) 2013 Eurofins Regulatory AG # Contact: jranke@uni-bremen.de @@ -16,8 +16,8 @@ # You should have received a copy of the GNU General Public License along with # this program. If not, see <http://www.gnu.org/licenses/> -mkinsub <- function(submodel, to = NULL, sink = TRUE) +mkinsub <- function(submodel, to = NULL, sink = TRUE, full_name = NA) { - return(list(type = submodel, to = to, sink = sink)) + return(list(type = submodel, to = to, sink = sink, full_name = full_name)) } # vim: set ts=2 sw=2 expandtab: diff --git a/R/plot.mkinfit.R b/R/plot.mkinfit.R index 31746fb8..f8ee600e 100644 --- a/R/plot.mkinfit.R +++ b/R/plot.mkinfit.R @@ -1,4 +1,4 @@ -# Copyright (C) 2010-2014 Johannes Ranke +# Copyright (C) 2010-2015 Johannes Ranke # Contact: jranke@uni-bremen.de # This file is part of the R package mkin @@ -76,7 +76,11 @@ plot.mkinfit <- function(x, fit = x, } matlines(out$time, out[obs_vars], col = col_obs[obs_vars], lty = lty_obs[obs_vars]) if (legend == TRUE) { - legend(lpos, inset= inset, legend = obs_vars, + legend_names = lapply(names(fit$mkinmod$spec), function(x) { + if (is.na(fit$mkinmod$spec[[x]]$full_name)) x + else fit$mkinmod$spec[[x]]$full_name + }) + legend(lpos, inset= inset, legend = legend_names, col = col_obs[obs_vars], pch = pch_obs[obs_vars], lty = lty_obs[obs_vars]) } # Show residuals if requested @@ -2,9 +2,4 @@ * preparing ‘mkin’: * checking DESCRIPTION meta-information ... OK * installing the package to build vignettes -* creating vignettes ... OK -* checking for LF line-endings in source and make files -* checking for empty or unneeded directories -* looking to see if a ‘data/datalist’ file should be added -* building ‘mkin_0.9-40.tar.gz’ - +* creating vignettes ...
\ No newline at end of file diff --git a/man/mkinsub.Rd b/man/mkinsub.Rd index 9eeffda0..352c4097 100644 --- a/man/mkinsub.Rd +++ b/man/mkinsub.Rd @@ -8,7 +8,7 @@ \code{\link{mkinmod}}. } \usage{ -mkinsub(submodel, to = NULL, sink = TRUE) +mkinsub(submodel, to = NULL, sink = TRUE, full_name = NA) } \arguments{ \item{submodel}{ @@ -23,6 +23,12 @@ mkinsub(submodel, to = NULL, sink = TRUE) Should a pathway to sink be included in the model in addition to the pathways to other state variables? } + \item{full_name}{ + An optional name to be used e.g. for plotting fits performed with the model. + You can use non-ASCII characters here, but then your R code will not be + portable, \emph{i.e.} may produce unintended plot results on other + operating systems or system configurations. + } } \value{ A list for use with \code{\link{mkinmod}}. @@ -40,5 +46,10 @@ SFO_SFO <- mkinmod( SFO_SFO.2 <- mkinmod( parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO")) + +# Now supplying full names +SFO_SFO.2 <- mkinmod( + parent = mkinsub("SFO", "m1", full_name = "Test compound"), + m1 = mkinsub("SFO", full_name = "Metabolite M1")) } diff --git a/man/plot.mkinfit.Rd b/man/plot.mkinfit.Rd index f26aac4c..494dc38d 100644 --- a/man/plot.mkinfit.Rd +++ b/man/plot.mkinfit.Rd @@ -82,7 +82,8 @@ \examples{ # One parent compound, one metabolite, both single first order, path from # parent to sink included -SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO")) +SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1", full = "Parent"), + m1 = mkinsub("SFO", full = "Metabolite M1" )) fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE) plot(fit) } |