aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2018-09-15 08:03:30 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2018-09-15 08:03:30 +0200
commit074ba16b2f5a27f92492b129120d25f33cd33f70 (patch)
tree92d58607845c8530243d54476f5e8737b7b49245
parent587662437bce06ea202551048226b86cff0db187 (diff)
Respect reps argument in add_err
-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