aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DESCRIPTION4
-rw-r--r--R/mkinfit.R13
2 files changed, 9 insertions, 8 deletions
diff --git a/DESCRIPTION b/DESCRIPTION
index 494793c..0ef8ba6 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -2,8 +2,8 @@ Package: mkin
Type: Package
Title: Routines for fitting kinetic models with one or more state
variables to chemical degradation data
-Version: 0.9-08
-Date: 2012-11-26
+Version: 0.9-09
+Date: 2013-02-05
Author: Johannes Ranke, Katrin Lindenberger, René Lehmann
Maintainer: Johannes Ranke <jranke@uni-bremen.de>
Description: Calculation routines based on the FOCUS Kinetics Report (2006).
diff --git a/R/mkinfit.R b/R/mkinfit.R
index 3649b20..f574b6e 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -36,11 +36,11 @@ mkinfit <- function(mkinmod, observed,
# Get the names of the state variables in the model
mod_vars <- names(mkinmod$diffs)
- # Subset observed data with names of observed data in the model
- observed <- subset(observed, name %in% names(mkinmod$map))
+ # Get the names of observed variables
+ obs_vars = names(mkinmod$map)
- # Get names of observed variables
- obs_vars = unique(as.character(observed$name))
+ # Subset observed data with names of observed data in the model
+ observed <- subset(observed, name %in% obs_vars)
# Define starting values for parameters where not specified by the user
if (parms.ini[[1]] == "auto") parms.ini = vector()
@@ -152,12 +152,13 @@ mkinfit <- function(mkinmod, observed,
xlim = range(observed$time), ylim = range(observed$value, na.rm=TRUE),
xlab = "Time", ylab = "Observed")
col_obs <- pch_obs <- 1:length(obs_vars)
- names(col_obs) <- names(pch_obs) <- obs_vars
+ lty_obs <- rep(1, length(obs_vars))
+ names(col_obs) <- names(pch_obs) <- names(lty_obs) <- obs_vars
for (obs_var in obs_vars) {
points(subset(observed, name == obs_var, c(time, value)),
pch = pch_obs[obs_var], col = col_obs[obs_var])
}
- matlines(out_plot$time, out_plot[-1])
+ matlines(out_plot$time, out_plot[-1], co = col_obs, lty = lty_obs)
legend("topright", inset=c(0.05, 0.05), legend=obs_vars,
col=col_obs, pch=pch_obs, lty=1:length(pch_obs))
}

Contact - Imprint