aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--R/set_nd.R10
-rw-r--r--docs/reference/set_nd.html4
-rw-r--r--man/set_nd.Rd4
-rw-r--r--tests/testthat/test_set_nd.R2
5 files changed, 23 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index a14aa23..b0775e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+commit a5503d3e26408f7308a7bf4da617205b93d17422
+Author: Johannes Ranke <jranke@uni-bremen.de>
+Date: 2019-10-10 09:21:46 +0200
+
+ Fix documentation for set_nd
+
+commit a5e458ecb33ae87e46b2237174a194f6252a97cf
+Author: Johannes Ranke <jranke@uni-bremen.de>
+Date: 2019-10-10 08:53:30 +0200
+
+ Finish documentation of set_nd and test it
+
commit 63df3871a442de4bf47e4d9de1449e7f6ed65b2f
Author: Johannes Ranke <jranke@uni-bremen.de>
Date: 2019-10-09 19:17:07 +0200
diff --git a/R/set_nd.R b/R/set_nd.R
index 10c5cba..b2fb720 100644
--- a/R/set_nd.R
+++ b/R/set_nd.R
@@ -17,10 +17,10 @@
#' @param loq Limit of quantification(numeric). Must be specified if the FOCUS rule to
#' stop after the first non-detection is to be applied
#' @param time_zero Is the first value in the series a time zero value?
-#' @param time_zero_nd_value Which value should we use for non-detects at time zero?
+#' @param time_zero_nd_value Which value should we use for non-detects or zero values at time zero?
#' @param stop_after_first_nondetect Should we really stop after the first non-detection?
#' @references FOCUS (2014) Generic Guidance for Estimating Persistence and Degradation
-#' Kinetics from Environmental Fate Studies on Pesticides in EU Registration, Version 1.1,
+#' Kinetics from Environmental Fate Studies on Pesticides in EU Registration, Version 1.1,
#' 18 December 2014, p. 251
#' @describeIn set_nd Set non-detects in residues series
#' @export
@@ -56,7 +56,7 @@ set_nd <- function(r, lod, loq = NA,
# Handle nd values
if (time_zero) {
- if (r[1] == "nd") {
+ if (r[1] %in% c("nd", 0)) {
residues_present = FALSE
result[1] <- time_zero_nd_value
} else {
@@ -94,12 +94,12 @@ set_nd <- function(r, lod, loq = NA,
return(as.numeric(result))
}
}
-
}
if (!residues_in_next) residues_present <- FALSE
else residues_present <- TRUE
+ } else {
+ residues_present <- TRUE
}
-
}
return(as.numeric(result))
}
diff --git a/docs/reference/set_nd.html b/docs/reference/set_nd.html
index 75a8fb1..7b0e779 100644
--- a/docs/reference/set_nd.html
+++ b/docs/reference/set_nd.html
@@ -154,7 +154,7 @@ stop after the first non-detection is to be applied</p></td>
</tr>
<tr>
<th>time_zero_nd_value</th>
- <td><p>Which value should we use for non-detects at time zero?</p></td>
+ <td><p>Which value should we use for non-detects or zero values at time zero?</p></td>
</tr>
<tr>
<th>stop_after_first_nondetect</th>
@@ -173,7 +173,7 @@ stop after the first non-detection is to be applied</p></td>
<h2 class="hasAnchor" id="references"><a class="anchor" href="#references"></a>References</h2>
<p>FOCUS (2014) Generic Guidance for Estimating Persistence and Degradation
- Kinetics from Environmental Fate Studies on Pesticides in EU Registration, Version 1.1,
+ Kinetics from Environmental Fate Studies on Pesticides in EU Registration, Version 1.1,
18 December 2014, p. 251</p>
diff --git a/man/set_nd.Rd b/man/set_nd.Rd
index bdbc6d2..085b606 100644
--- a/man/set_nd.Rd
+++ b/man/set_nd.Rd
@@ -22,7 +22,7 @@ stop after the first non-detection is to be applied}
\item{time_zero}{Is the first value in the series a time zero value?}
-\item{time_zero_nd_value}{Which value should we use for non-detects at time zero?}
+\item{time_zero_nd_value}{Which value should we use for non-detects or zero values at time zero?}
\item{stop_after_first_nondetect}{Should we really stop after the first non-detection?}
}
@@ -59,6 +59,6 @@ set_nd(metabolite, 0.02)
}
\references{
FOCUS (2014) Generic Guidance for Estimating Persistence and Degradation
- Kinetics from Environmental Fate Studies on Pesticides in EU Registration, Version 1.1,
+ Kinetics from Environmental Fate Studies on Pesticides in EU Registration, Version 1.1,
18 December 2014, p. 251
}
diff --git a/tests/testthat/test_set_nd.R b/tests/testthat/test_set_nd.R
index 29087a8..6b73e2d 100644
--- a/tests/testthat/test_set_nd.R
+++ b/tests/testthat/test_set_nd.R
@@ -17,6 +17,8 @@ test_that("Simple residue series processed as intended", {
expect_equal(set_nd(metabolite, 0.02, loq = 0.05),
c(NA, NA, .01, .03, .06, .1, .11, .1, .09, .05, .03, .01, NA))
+ expect_equal(set_nd(c("nd", 1, 0.2, "nd"), 0.1), c(NA, 1, 0.2, 0.05))
+
})
test_that("Simple residue series are processed as in the FOCUS guidance", {

Contact - Imprint