aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-10-10 12:25:42 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2019-10-10 12:26:49 +0200
commita071d46f698397a6c8247e19eceb0fcd5f139056 (patch)
treee490eecf5ff5e0376d32964974875c790d2455ce /R
parenta5503d3e26408f7308a7bf4da617205b93d17422 (diff)
Fix set_nd for metabolites, handle zero at time zero
Diffstat (limited to 'R')
-rw-r--r--R/set_nd.R10
1 files changed, 5 insertions, 5 deletions
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))
}

Contact - Imprint