diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/DESCRIPTION | 10 | ||||
-rw-r--r-- | pkg/R/GUS.R | 29 | ||||
-rw-r--r-- | pkg/R/endpoint.R | 3 | ||||
-rw-r--r-- | pkg/man/GUS.Rd | 29 | ||||
-rw-r--r-- | pkg/man/endpoint.Rd | 5 | ||||
-rw-r--r-- | pkg/man/soil_DT50.Rd | 4 | ||||
-rw-r--r-- | pkg/man/soil_Kfoc.Rd | 4 | ||||
-rw-r--r-- | pkg/man/soil_N.Rd | 4 | ||||
-rw-r--r-- | pkg/man/soil_sorption.Rd | 4 |
9 files changed, 66 insertions, 26 deletions
diff --git a/pkg/DESCRIPTION b/pkg/DESCRIPTION index fb9171f..d092444 100644 --- a/pkg/DESCRIPTION +++ b/pkg/DESCRIPTION @@ -2,7 +2,7 @@ Package: pfm Type: Package Title: Utilities for Pesticide Fate Modelling Version: 0.2-4 -Date: 2015-10-15 +Date: 2015-12-18 Authors@R: person("Johannes Ranke", email = "jranke@uni-bremen.de", role = c("aut", "cre", "cph")) Description: Utilities for simple calculations of predicted environmental @@ -12,12 +12,12 @@ Depends: R6, mkin Imports: - graphics -Suggests: - testthat, + graphics, chents +Suggests: + testthat License: GPL LazyLoad: yes LazyData: yes Encoding: UTF-8 -RoxygenNote: 4.1.1.9001 +RoxygenNote: 5.0.1 diff --git a/pkg/R/GUS.R b/pkg/R/GUS.R index 2690f50..8a20561 100644 --- a/pkg/R/GUS.R +++ b/pkg/R/GUS.R @@ -5,11 +5,9 @@ #' \deqn{GUS = \log_10 DT50_{soil} (4 - \log_10 K_{oc}}{GUS = log10 DT50soil * (4 - log10 Koc)} #' #' @references Gustafson, David I. (1989) Groundwater ubiquity score: a simple -#' method for assessing pesticide leachability. _Environmental -#' toxicology and chemistry_ *8*(4) 339–57. +#' method for assessing pesticide leachability. \emph{Environmental +#' toxicology and chemistry} \bold{8}(4) 339–57. #' @inheritParams endpoint -#' @param chent If a chent is given with appropriate information present in its -#' chyaml field, this information is used, with defaults specified below. #' @param DT50 Half-life of the chemical in soil. Should be a field #' half-life according to Gustafson (1989). However, leaching to the sub-soil #' can not completely be excluded in field dissipation experiments and Gustafson @@ -20,13 +18,16 @@ #' found and usually described by Freundlich sorption, therefore it is #' unclear at which reference concentration the Koc should be observed #' (and if the reference concentration would be in soil or in porewater). +#' @param chent If a chent is given with appropriate information present in its +#' chyaml field, this information is used, with defaults specified below. +#' @param degradation_value Which of the available degradation values should +#' be used? #' @param lab_field Should laboratory or field half-lives be used? This #' defaults to lab in this implementation, in order to avoid #' double-accounting for mobility. If comparability with the original GUS #' values given by Gustafson (1989) is desired, non-normalised first-order #' field half-lives obtained under actual use conditions should be used. -#' @param degradation_value Which of the available degradation values should -#' be used? +#' @param redox Aerobic or anaerobic degradation data #' @param sorption_value Which of the available sorption values should be used? #' Defaults to Kfoc as this is what is generally available from the European #' pesticide peer review process. These values generally use a reference @@ -34,6 +35,8 @@ #' be Koc values at a concentration of 1 mg/L in the water phase. #' @param degradation_aggregator Function for aggregating half-lives #' @param sorption_aggregator Function for aggregation Koc values +#' @param ... Included in the generic to allow for further arguments later. Therefore +#' this also had to be added to the specific methods. #' @return A list with the DT50 and Koc used as well as the resulting score #' of class GUS_result #' @author Johannes Ranke @@ -42,7 +45,7 @@ GUS <- function(...) UseMethod("GUS") #' @rdname GUS #' @export -GUS.numeric <- function(DT50, Koc) { +GUS.numeric <- function(DT50, Koc, ...) { score <- log10(DT50) * (4 - log10(Koc)) res <- list(DT50 = DT50, Koc = Koc, score = score) class(res) <- "GUS_result" @@ -51,15 +54,16 @@ GUS.numeric <- function(DT50, Koc) { #' @rdname GUS #' @export -GUS.chent <- function(chent, lab_field = "laboratory", - aerobic = TRUE, +GUS.chent <- function(chent, degradation_value = "DT50ref", + lab_field = "laboratory", + redox = "aerobic", sorption_value = "Kfoc", degradation_aggregator = geomean, sorption_aggregator = geomean, - digits = 1) + ...) { - DT50 = soil_DT50(chent, lab_field = lab_field, redox = aerobic, + DT50 = soil_DT50(chent, lab_field = lab_field, redox = redox, value = degradation_value, aggregator = degradation_aggregator, signif = 5) Koc = soil_Kfoc(chent, value = sorption_value, @@ -67,7 +71,10 @@ GUS.chent <- function(chent, lab_field = "laboratory", GUS.numeric(DT50, Koc) } +#' @rdname GUS #' @export +#' @param x An object of class GUS_result to be printed +#' @param digits The number of digits used in the print method print.GUS_result = function(x, ..., digits = 1) { cat("GUS: ", round(x$score, digits = 1), "\n") cat("calculated from DT50 ", x$DT50, " and Koc ", x$Koc, "\n") diff --git a/pkg/R/endpoint.R b/pkg/R/endpoint.R index f9b9102..6cc253a 100644 --- a/pkg/R/endpoint.R +++ b/pkg/R/endpoint.R @@ -16,6 +16,9 @@ #' usage section is not exclusive #' @param aggregator The aggregator function. Can be mean, #' \code{\link{geomean}}, or identity, for example. +#' @param raw Should the number(s) be returned as stored in the chent +#' object (could be a character value) to retain original information +#' about precision? #' @param signif How many significant digits do we want #' @return The result from applying the aggregator function to #' the values converted to a numeric vector, rounded to the diff --git a/pkg/man/GUS.Rd b/pkg/man/GUS.Rd index 5e2c936..33c7364 100644 --- a/pkg/man/GUS.Rd +++ b/pkg/man/GUS.Rd @@ -4,18 +4,23 @@ \alias{GUS} \alias{GUS.chent} \alias{GUS.numeric} +\alias{print.GUS_result} \title{Groundwater ubiquity score based on Gustafson (1989)} \usage{ GUS(...) -\method{GUS}{numeric}(DT50, Koc) +\method{GUS}{numeric}(DT50, Koc, ...) -\method{GUS}{chent}(chent, lab_field = "laboratory", aerobic = TRUE, - degradation_value = "DT50ref", sorption_value = "Kfoc", - degradation_aggregator = geomean, sorption_aggregator = geomean, - digits = 1) +\method{GUS}{chent}(chent, degradation_value = "DT50ref", + lab_field = "laboratory", redox = "aerobic", sorption_value = "Kfoc", + degradation_aggregator = geomean, sorption_aggregator = geomean, ...) + +\method{print}{GUS_result}(x, ..., digits = 1) } \arguments{ +\item{...}{Included in the generic to allow for further arguments later. Therefore +this also had to be added to the specific methods.} + \item{DT50}{Half-life of the chemical in soil. Should be a field half-life according to Gustafson (1989). However, leaching to the sub-soil can not completely be excluded in field dissipation experiments and Gustafson @@ -31,14 +36,16 @@ unclear at which reference concentration the Koc should be observed \item{chent}{If a chent is given with appropriate information present in its chyaml field, this information is used, with defaults specified below.} +\item{degradation_value}{Which of the available degradation values should +be used?} + \item{lab_field}{Should laboratory or field half-lives be used? This defaults to lab in this implementation, in order to avoid double-accounting for mobility. If comparability with the original GUS values given by Gustafson (1989) is desired, non-normalised first-order field half-lives obtained under actual use conditions should be used.} -\item{degradation_value}{Which of the available degradation values should -be used?} +\item{redox}{Aerobic or anaerobic degradation data} \item{sorption_value}{Which of the available sorption values should be used? Defaults to Kfoc as this is what is generally available from the European @@ -49,6 +56,10 @@ be Koc values at a concentration of 1 mg/L in the water phase.} \item{degradation_aggregator}{Function for aggregating half-lives} \item{sorption_aggregator}{Function for aggregation Koc values} + +\item{x}{An object of class GUS_result to be printed} + +\item{digits}{The number of digits used in the print method} } \value{ A list with the DT50 and Koc used as well as the resulting score @@ -64,7 +75,7 @@ Johannes Ranke } \references{ Gustafson, David I. (1989) Groundwater ubiquity score: a simple -method for assessing pesticide leachability. _Environmental -toxicology and chemistry_ *8*(4) 339–57. +method for assessing pesticide leachability. \emph{Environmental +toxicology and chemistry} \bold{8}(4) 339–57. } diff --git a/pkg/man/endpoint.Rd b/pkg/man/endpoint.Rd index 6c93022..0ca53b1 100644 --- a/pkg/man/endpoint.Rd +++ b/pkg/man/endpoint.Rd @@ -26,6 +26,10 @@ usage section is not exclusive} \item{aggregator}{The aggregator function. Can be mean, \code{\link{geomean}}, or identity, for example.} +\item{raw}{Should the number(s) be returned as stored in the chent +object (could be a character value) to retain original information +about precision?} + \item{signif}{How many significant digits do we want} } \value{ @@ -34,7 +38,6 @@ The result from applying the aggregator function to given number of significant digits, or, if raw = TRUE, the values as a character value, retaining any implicit information on precision that may be present. - } \description{ R6 class objects of class \code{\link{chent}} represent chemical entities diff --git a/pkg/man/soil_DT50.Rd b/pkg/man/soil_DT50.Rd index cbec234..89d2883 100644 --- a/pkg/man/soil_DT50.Rd +++ b/pkg/man/soil_DT50.Rd @@ -22,6 +22,10 @@ soil_DT50(chent, aggregator = geomean, signif = 3, usage section is not exclusive} \item{redox}{If not NA, are we looking for aerobic or anaerobic data} + +\item{raw}{Should the number(s) be returned as stored in the chent +object (could be a character value) to retain original information +about precision?} } \description{ Obtain soil DT50 diff --git a/pkg/man/soil_Kfoc.Rd b/pkg/man/soil_Kfoc.Rd index 3cc67cd..b8c0727 100644 --- a/pkg/man/soil_Kfoc.Rd +++ b/pkg/man/soil_Kfoc.Rd @@ -17,6 +17,10 @@ soil_Kfoc(chent, aggregator = geomean, signif = 3, value = "Kfoc", \item{value}{The name of the value we want. The list given in the usage section is not exclusive} + +\item{raw}{Should the number(s) be returned as stored in the chent +object (could be a character value) to retain original information +about precision?} } \description{ Obtain soil Kfoc diff --git a/pkg/man/soil_N.Rd b/pkg/man/soil_N.Rd index 9045ea8..9564f82 100644 --- a/pkg/man/soil_N.Rd +++ b/pkg/man/soil_N.Rd @@ -13,6 +13,10 @@ soil_N(chent, aggregator = mean, signif = 3, raw = FALSE) \code{\link{geomean}}, or identity, for example.} \item{signif}{How many significant digits do we want} + +\item{raw}{Should the number(s) be returned as stored in the chent +object (could be a character value) to retain original information +about precision?} } \description{ In pesticide fate modelling, this exponent is often called 1/n. Here, in diff --git a/pkg/man/soil_sorption.Rd b/pkg/man/soil_sorption.Rd index 41b8794..5b8bd53 100644 --- a/pkg/man/soil_sorption.Rd +++ b/pkg/man/soil_sorption.Rd @@ -16,6 +16,10 @@ soil_sorption(chent, values = c("Kfoc", "N"), aggregators = c(Kfoc = \item{aggregators}{A named vector of aggregator functions to be used} \item{signif}{How many significant digits do we want} + +\item{raw}{Should the number(s) be returned as stored in the chent +object (could be a character value) to retain original information +about precision?} } \description{ Obtain soil sorption data |