aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2018-02-02 10:02:23 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2018-02-02 10:02:23 +0100
commit4de47be0bc4e6b923a6db15b9abc461046a99eac (patch)
tree9623be5441772724d572f3690c85694456a19847 /R
parent3147a8c1ec1aa81097bd9897b33b703ae3a5d20f (diff)
Show R and mkin version used for fitting in the summary
For fits generated with previous version, the version numbers used for fitting were not stored in the fit object. Therefore, the versions used for fitting can only be shown for fits generated with mkin containing this commit.
Diffstat (limited to 'R')
-rw-r--r--R/mkinfit.R17
1 files changed, 15 insertions, 2 deletions
diff --git a/R/mkinfit.R b/R/mkinfit.R
index adc20a9f..ab7b5ad2 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -597,6 +597,8 @@ mkinfit <- function(mkinmod, observed,
names(fit$bparms.state) <- gsub("_0$", "", names(fit$bparms.state))
fit$date <- date()
+ fit$version <- as.character(utils::packageVersion("mkin"))
+ fit$Rversion <- paste(R.version$major, R.version$minor, sep=".")
class(fit) <- c("mkinfit", "modFit")
return(fit)
@@ -694,6 +696,11 @@ summary.mkinfit <- function(object, data = TRUE, distimes = TRUE, alpha = 0.05,
par = param,
bpar = bparam)
+ if (!is.null(object$version)) {
+ ans$fit_version <- object$version
+ ans$fit_Rversion <- object$Rversion
+ }
+
ans$diffs <- object$mkinmod$diffs
if(data) ans$data <- object$data
ans$start <- object$start
@@ -715,8 +722,14 @@ summary.mkinfit <- function(object, data = TRUE, distimes = TRUE, alpha = 0.05,
# Expanded from print.summary.modFit
print.summary.mkinfit <- function(x, digits = max(3, getOption("digits") - 3), ...) {
- cat("mkin version: ", x$version, "\n")
- cat("R version: ", x$Rversion, "\n")
+ if (is.null(x$fit_version)) {
+ cat("mkin version: ", x$version, "\n")
+ cat("R version: ", x$Rversion, "\n")
+ } else {
+ cat("mkin version used for fitting: ", x$fit_version, "\n")
+ cat("R version used for fitting: ", x$fit_Rversion, "\n")
+ }
+
cat("Date of fit: ", x$date.fit, "\n")
cat("Date of summary:", x$date.summary, "\n")

Contact - Imprint