aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-07-23 10:51:39 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2020-07-23 10:51:39 +0200
commit90fa42c86596c85168931148bf8d5fa014fa7794 (patch)
tree3545ec8a4842a3760c199e3d4999702f133c0c37 /R
parentdf70d80d9ef13b69e58de6f47b9041b6a021025e (diff)
Update docs, use R6 support of roxygen
Diffstat (limited to 'R')
-rw-r--r--R/GUS.R1
-rw-r--r--R/TOXSWA_cwa.R56
-rw-r--r--R/drift_data_JKI.R4
-rw-r--r--R/endpoint.R4
4 files changed, 37 insertions, 28 deletions
diff --git a/R/GUS.R b/R/GUS.R
index 040857a..32f371c 100644
--- a/R/GUS.R
+++ b/R/GUS.R
@@ -7,7 +7,6 @@
#' @references Gustafson, David I. (1989) Groundwater ubiquity score: a simple
#' method for assessing pesticide leachability. \emph{Environmental
#' toxicology and chemistry} \bold{8}(4) 339–57.
-#' @inheritParams endpoint
#' @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
diff --git a/R/TOXSWA_cwa.R b/R/TOXSWA_cwa.R
index 42cdd35..6521349 100644
--- a/R/TOXSWA_cwa.R
+++ b/R/TOXSWA_cwa.R
@@ -142,35 +142,24 @@ plot.TOXSWA_cwa <- function(x, time_column = c("datetime", "t", "t_firstjan", "t
#' R6 class for holding TOXSWA water concentration data and associated statistics
#'
-#' An R6 class for holding TOXSWA water concentration (cwa) data and some associated statistics.
-#' Usually, an instance of this class will be generated by \code{\link{read.TOXSWA_cwa}}.
+#' @description An R6 class for holding TOXSWA water concentration (cwa) data
+#' and some associated statistics. like maximum moving window average
+#' concentrations, and dataframes holding the events exceeding specified
+#' thresholds. Usually, an instance of this class will be generated
+#' by \code{\link{read.TOXSWA_cwa}}.
#'
-#' @docType class
-#' @importFrom R6 R6Class
#' @export
#' @format An \code{\link{R6Class}} generator object.
-#' @field filename Length one character vector.
-#' @field basedir Length one character vector.
+#' @field filename Length one character vector holding the filename.
+#' @field basedir Length one character vector holding the directory where the file came from.
+#' @field zipfile If not null, giving the path to the zip file from which the file was read.
#' @field segment Length one integer, specifying for which segment the cwa data were read.
+#' @field substance The TOXSWA name of the substance.
#' @field cwas Dataframe holding the concentrations.
#' @field events List of dataframes holding the event statistics for each threshold.
#' @field windows Matrix of maximum time weighted average concentrations (TWAC_max)
#' and areas under the curve in µg/day * h (AUC_max_h) or µg/day * d (AUC_max_d)
#' for the requested moving window sizes in days.
-#' @section Methods:
-#' \describe{
-#' \item{\code{get_events(threshold, total = FALSE)}}{
-#' Populate a datataframe with event information for the specified threshold value
-#' in µg/L. If \code{total = TRUE}, the total concentration including the amount
-#' adsorbed to suspended matter will be used. The resulting dataframe is stored in the
-#' \code{events} field of the object.
-#' }
-#' \item{\code{moving_windows(windows, total = FALSE)}}{
-#' Add to the \code{windows} field described above.
-#' Again, if \code{total = TRUE}, the total concentration including the amount
-#' adsorbed to suspended matter will be used.
-#' }
-#' }
#' @examples
#' H_sw_R1_stream <- read.TOXSWA_cwa("00003s_pa.cwa",
#' basedir = "SwashProjects/project_H_sw/TOXSWA",
@@ -180,7 +169,6 @@ plot.TOXSWA_cwa <- function(x, time_column = c("datetime", "t", "t_firstjan", "t
#' H_sw_R1_stream$moving_windows(c(7, 21))
#' print(H_sw_R1_stream)
#' @keywords data
-
TOXSWA_cwa <- R6Class("TOXSWA_cwa",
public = list(
filename = NULL,
@@ -191,6 +179,15 @@ TOXSWA_cwa <- R6Class("TOXSWA_cwa",
cwas = NULL,
windows = NULL,
events = list(),
+
+ #' @description
+ #' Create a TOXSWA_cwa object from a file
+ #' @param filename The filename
+ #' @param basedir The directory to look in
+ #' @param zipfile Optional path to a zipfile holding the file
+ #' @param segment Either "last" or the number of the segment for which to read the data
+ #' @param substance The TOXSWA substance name (for TOXSWA 4 or higher)
+ #' @param total Should total concentrations be read in? If FALSE, free concentrations are read
initialize = function(filename, basedir, zipfile = NULL,
segment = "last", substance = "parent", total = FALSE) {
self$filename <- filename
@@ -327,6 +324,12 @@ TOXSWA_cwa <- R6Class("TOXSWA_cwa",
}
}
},
+
+ #' @description
+ #' Add to the `windows` field described above.
+ #' @param windows Window sizes in days
+ #' @param total If TRUE, the total concentration including the amount adsorbed to
+ #' suspended matter will be used.
moving_windows = function(windows, total = FALSE) {
window_names = paste(windows, "days")
n = length(window_names)
@@ -350,6 +353,14 @@ TOXSWA_cwa <- R6Class("TOXSWA_cwa",
}
invisible(self)
},
+
+ #' @description
+ #' Populate a datataframe with event information for the specified
+ #' threshold value. The resulting dataframe is stored in the `events`
+ #' field of the object.
+ #' @param thresholds Threshold values in µg/L.
+ #' @param total If TRUE, the total concentration including the amount adsorbed to
+ #' suspended matter will be used.
get_events = function(thresholds, total = FALSE) {
if (missing(thresholds)) {
stop("You need to specify at least one threshold concentration in \u03bcg/L")
@@ -397,6 +408,9 @@ TOXSWA_cwa <- R6Class("TOXSWA_cwa",
}
invisible(self)
},
+
+ #' @description
+ #' Print a `TOXSWA_cwa` object
print = function() {
cat("<TOXSWA_cwa> data from file", self$filename, "segment", self$segment, "\n")
print(head(self$cwas))
diff --git a/R/drift_data_JKI.R b/R/drift_data_JKI.R
index e44079d..3b02f43 100644
--- a/R/drift_data_JKI.R
+++ b/R/drift_data_JKI.R
@@ -30,7 +30,7 @@
#' from
#' http://www.jki.bund.de/no_cache/de/startseite/institute/anwendungstechnik/abdrift-eckwerte.html
#' on 2015-06-11
-#'
+#'
#' Rautmann, D., Streloke, M and Winkler, R (2001) New basic drift values in
#' the authorization procedure for plant protection products Mitt. Biol.
#' Bundesanst. Land- Forstwirtsch. 383, 133-141
@@ -82,6 +82,6 @@
#' save(drift_data_JKI, file = "data/drift_data_JKI.RData")
#' }
#'
-#' # And this is the resulting data
+#' # And these are the resulting data
#' drift_data_JKI
NULL
diff --git a/R/endpoint.R b/R/endpoint.R
index 56a314b..08856f9 100644
--- a/R/endpoint.R
+++ b/R/endpoint.R
@@ -55,7 +55,6 @@ endpoint <- function(chent,
else return(signif(aggregator(as.numeric(values)), signif))
}
-#' @inheritParams endpoint
#' @rdname endpoint
#' @export
soil_DT50 <- function(chent, aggregator = geomean, signif = 3,
@@ -68,7 +67,6 @@ soil_DT50 <- function(chent, aggregator = geomean, signif = 3,
return(ep)
}
-#' @inheritParams endpoint
#' @rdname endpoint
#' @export
soil_Kfoc <- function(chent, aggregator = geomean, signif = 3,
@@ -79,7 +77,6 @@ soil_Kfoc <- function(chent, aggregator = geomean, signif = 3,
return(ep)
}
-#' @inheritParams endpoint
#' @rdname endpoint
#' @export
soil_N <- function(chent, aggregator = mean, signif = 3, raw = FALSE) {
@@ -89,7 +86,6 @@ soil_N <- function(chent, aggregator = mean, signif = 3, raw = FALSE) {
return(ep)
}
-#' @inheritParams endpoint
#' @rdname endpoint
#' @param values The values to be returned
#' @param aggregators A named vector of aggregator functions to be used

Contact - Imprint