diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2018-02-02 10:02:23 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2018-02-02 10:02:23 +0100 |
commit | 4de47be0bc4e6b923a6db15b9abc461046a99eac (patch) | |
tree | 9623be5441772724d572f3690c85694456a19847 | |
parent | 3147a8c1ec1aa81097bd9897b33b703ae3a5d20f (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.
-rw-r--r-- | NEWS.md | 4 | ||||
-rw-r--r-- | R/mkinfit.R | 17 | ||||
-rw-r--r-- | docs/news/index.html | 7 |
3 files changed, 22 insertions, 6 deletions
@@ -1,4 +1,4 @@ -# mkin 0.9.47.1 (2017-01-30) +# mkin 0.9.47.1 (2017-02-02) - 'test_data_from_UBA_2014': Added this list of datasets containing experimental data used in the expertise from 2014 @@ -6,6 +6,8 @@ - 'summary.mkinfit': Improved output regarding weighting method. No predictions are returned for NA values in the model (see above). +- 'summary.mkinfit': Show versions of mkin and R used for fitting (not the ones used for the summary) if the fit was generated with mkin >= 0.9.47.1 + # mkin 0.9.46.3 (2017-11-16) - `README.md`, `vignettes/mkin.Rmd`: URLs were updated 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")
diff --git a/docs/news/index.html b/docs/news/index.html index 28ec949f..0e7ceabf 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -103,13 +103,14 @@ </div> <div class="contents"> - <div id="mkin-0-9-47-1-2017-01-30" class="section level1"> + <div id="mkin-0-9-47-1-2017-02-02" class="section level1"> <h1 class="hasAnchor"> -<a href="#mkin-0-9-47-1-2017-01-30" class="anchor"></a>mkin 0.9.47.1 (2017-01-30)</h1> +<a href="#mkin-0-9-47-1-2017-02-02" class="anchor"></a>mkin 0.9.47.1 (2017-02-02)</h1> <ul> <li><p>‘test_data_from_UBA_2014’: Added this list of datasets containing experimental data used in the expertise from 2014</p></li> <li><p>‘mkinfit’: Added the iterative reweighting method ‘tc’ using the two-component error model from Rocke and Lorenzato. NA values in the data are not returned any more.</p></li> <li><p>‘summary.mkinfit’: Improved output regarding weighting method. No predictions are returned for NA values in the model (see above).</p></li> +<li><p>‘summary.mkinfit’: Show versions of mkin and R used for fitting (not the ones used for the summary) if the fit was generated with mkin >= 0.9.47.1</p></li> </ul> </div> <div id="mkin-0-9-46-3-2017-11-16" class="section level1"> @@ -587,7 +588,7 @@ <div id="tocnav"> <h2>Contents</h2> <ul class="nav nav-pills nav-stacked"> - <li><a href="#mkin-0-9-47-1-2017-01-30">0.9.47.1</a></li> + <li><a href="#mkin-0-9-47-1-2017-02-02">0.9.47.1</a></li> <li><a href="#mkin-0-9-46-3-2017-11-16">0.9.46.3</a></li> <li><a href="#mkin-0-9-46-2-2017-10-10">0.9.46.2</a></li> <li><a href="#mkin-0-9-46-1-2017-09-14">0.9.46.1</a></li> |