aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS.md4
-rw-r--r--R/add_err.R4
2 files changed, 6 insertions, 2 deletions
diff --git a/NEWS.md b/NEWS.md
index d265dc6f..43146df9 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,7 @@
+# mkin 0.9.47.6 (2018-09-15)
+
+- 'add_err': Respect the argument giving the number of replicates in the synthetic dataset
+
# mkin 0.9.47.5 (2018-09-14)
- Make the two-component error model stop in cases where it is inadequate to avoid nls crashes on windows
diff --git a/R/add_err.R b/R/add_err.R
index 3b98338d..b2a1808e 100644
--- a/R/add_err.R
+++ b/R/add_err.R
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2017 Johannes Ranke
+# Copyright (C) 2015-2018 Johannes Ranke
# Contact: jranke@uni-bremen.de
# This file is part of the R package mkin
@@ -30,7 +30,7 @@ add_err = function(prediction, sdfunc, secondary = c("M1", "M2"),
# Generate datasets one by one in a loop
for (i in 1:n) {
- d_rep = data.frame(lapply(d_long, rep, each = 2))
+ d_rep = data.frame(lapply(d_long, rep, each = reps))
d_rep$value = rnorm(length(d_rep$value), d_rep$value, sdfunc(d_rep$value))
d_rep[d_rep$time == 0 & d_rep$name %in% secondary, "value"] <- 0

Contact - Imprint