From 90fa42c86596c85168931148bf8d5fa014fa7794 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 23 Jul 2020 10:51:39 +0200 Subject: Update docs, use R6 support of roxygen --- ChangeLog | 6 +++ DESCRIPTION | 8 ++-- NAMESPACE | 1 - R/GUS.R | 1 - R/TOXSWA_cwa.R | 56 +++++++++++++++--------- R/drift_data_JKI.R | 4 +- R/endpoint.R | 4 -- _pkgdown.yml | 3 ++ docs/pkgdown.yml | 2 +- docs/reference/TOXSWA_cwa.html | 82 +++++++++++++++++++++++------------- docs/reference/index.html | 19 +++++++++ docs/reference/pfm_degradation.html | 52 +++++++++++------------ docs/reference/sawtooth-2.png | Bin 37285 -> 42340 bytes docs/reference/sawtooth.html | 46 ++++++++++---------- man/TOXSWA_cwa.Rd | 76 +++++++++++++++++++++++---------- 15 files changed, 225 insertions(+), 135 deletions(-) diff --git a/ChangeLog b/ChangeLog index acad9ae..58e9249 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +commit df70d80d9ef13b69e58de6f47b9041b6a021025e +Author: Johannes Ranke +Date: 2020-07-21 15:50:21 +0200 + + Clean test.log after testing + commit 512cd50874b060d50a14d28df88018ac144cf6d3 Author: Johannes Ranke Date: 2020-07-07 12:36:56 +0200 diff --git a/DESCRIPTION b/DESCRIPTION index e877629..ef5c7a9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: pfm Type: Package Title: Utilities for Pesticide Fate Modelling -Version: 0.5.7 -Date: 2020-07-07 +Version: 0.5.8 +Date: 2020-07-23 Authors@R: person("Johannes Ranke", email = "jranke@uni-bremen.de", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0003-4371-6538")) @@ -31,5 +31,5 @@ License: GPL LazyLoad: yes LazyData: yes Encoding: UTF-8 -URL: https://pkdown.jrwb.de/pfm -RoxygenNote: 7.1.0 +URL: https://pkgdown.jrwb.de/pfm +RoxygenNote: 7.1.1 diff --git a/NAMESPACE b/NAMESPACE index e24d712..8b44855 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -46,7 +46,6 @@ export(soil_sorption) export(twa) import(graphics) import(mkin) -importFrom(R6,R6Class) importFrom(grDevices,dev.cur) importFrom(methods,is) importFrom(mkin,mkinpredict) 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(" 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 diff --git a/_pkgdown.yml b/_pkgdown.yml index 71f3c65..4f12b7c 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -53,6 +53,9 @@ reference: contents: - SSLRC_mobility_classification - GUS + - title: Work with chent objects containing relevant information + contents: + - endpoint - title: Utilities contents: - get_vertex diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 077f218..8b86fe9 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 2.2.1 pkgdown: 1.5.1 pkgdown_sha: ~ articles: [] -last_built: 2020-06-17T11:36Z +last_built: 2020-07-22T15:06Z urls: reference: https://pkgdown.jrwb.de/pfm/reference article: https://pkgdown.jrwb.de/pfm/articles diff --git a/docs/reference/TOXSWA_cwa.html b/docs/reference/TOXSWA_cwa.html index 9f9e3c3..16dc5db 100644 --- a/docs/reference/TOXSWA_cwa.html +++ b/docs/reference/TOXSWA_cwa.html @@ -40,8 +40,11 @@ - + @@ -110,8 +113,11 @@ Usually, an instance of this class will be generated by read.TOXSWA_cwa." />
-

An R6 class for holding TOXSWA water concentration (cwa) data and some associated statistics. -Usually, an instance of this class will be generated by read.TOXSWA_cwa.

+

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 read.TOXSWA_cwa.

@@ -119,30 +125,19 @@ Usually, an instance of this class will be generated by -
get_events(threshold, total = FALSE)

Populate a datataframe with event information for the specified threshold value - in µg/L. If total = TRUE, the total concentration including the amount - adsorbed to suspended matter will be used. The resulting dataframe is stored in the - events field of the object.

-
moving_windows(windows, total = FALSE)

Add to the windows field described above. - Again, if total = TRUE, the total concentration including the amount - adsorbed to suspended matter will be used.

- - -

Public fields

-
filename

Length one character vector.

+
filename

Length one character vector holding the filename.

-
basedir

Length one character vector.

+
basedir

Length one character vector holding the directory where the file came from.

+ +
zipfile

If not null, giving the path to the zip file from which the file was read.

segment

Length one integer, specifying for which segment the cwa data were read.

+
substance

The TOXSWA name of the substance.

+
cwas

Dataframe holding the concentrations.

events

List of dataframes holding the event statistics for each threshold.

@@ -166,8 +161,7 @@ for the requested moving window sizes in days.


Method new()

- -

Usage

+

Create a TOXSWA_cwa object from a file

Usage

TOXSWA_cwa$new(
   filename,
   basedir,
@@ -177,22 +171,52 @@ for the requested moving window sizes in days.

total = FALSE )

+

Arguments

+

+
filename

The filename

+ +
basedir

The directory to look in

+ +
zipfile

Optional path to a zipfile holding the file

+ +
segment

Either "last" or the number of the segment for which to read the data

+ +
substance

The TOXSWA substance name (for TOXSWA 4 or higher)

+ +
total

Should total concentrations be read in? If FALSE, free concentrations are read

+ +


Method moving_windows()

- -

Usage

+

Add to the `windows` field described above.

Usage

TOXSWA_cwa$moving_windows(windows, total = FALSE)

+

Arguments

+

+
windows

Window sizes in days

+ +
total

If TRUE, the total concentration including the amount adsorbed to +suspended matter will be used.

+ +


Method get_events()

- -

Usage

+

Populate a datataframe with event information for the specified +threshold value. The resulting dataframe is stored in the `events` +field of the object.

Usage

TOXSWA_cwa$get_events(thresholds, total = FALSE)

+

Arguments

+

+
thresholds

Threshold values in µg/L.

+ +
total

If TRUE, the total concentration including the amount adsorbed to +suspended matter will be used.

+ +


Method print()

- -

Usage

+

Print a `TOXSWA_cwa` object

Usage

TOXSWA_cwa$print()


diff --git a/docs/reference/index.html b/docs/reference/index.html index 944f1f2..186390e 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -390,6 +390,25 @@ water concentrations

Groundwater ubiquity score based on Gustafson (1989)

+ + + +

Work with chent objects containing relevant information

+

+ + + + + + + + + + +

endpoint() soil_DT50() soil_Kfoc() soil_N() soil_sorption()

+ +

Retrieve endpoint information from the chyaml field of a chent object

+ diff --git a/docs/reference/pfm_degradation.html b/docs/reference/pfm_degradation.html index d2e62f6..8d06107 100644 --- a/docs/reference/pfm_degradation.html +++ b/docs/reference/pfm_degradation.html @@ -10,23 +10,27 @@ - + - + - + + + + + - - + + - + - - + + @@ -37,7 +41,6 @@ - @@ -55,7 +58,7 @@ - +
- @@ -178,7 +176,7 @@ is calculated (SFO model).

-

Site built with pkgdown 1.4.1.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/reference/sawtooth-2.png b/docs/reference/sawtooth-2.png index ad93165..87da954 100644 Binary files a/docs/reference/sawtooth-2.png and b/docs/reference/sawtooth-2.png differ diff --git a/docs/reference/sawtooth.html b/docs/reference/sawtooth.html index 7720afc..fea24d4 100644 --- a/docs/reference/sawtooth.html +++ b/docs/reference/sawtooth.html @@ -10,23 +10,27 @@ - + - + - + + + + + - - + + - + - - + + @@ -36,9 +40,8 @@ - - @@ -56,7 +59,7 @@ n and i are disregarded." /> - +
-

If the application pattern is specified in applications, +

If the application pattern is specified in applications, n and i are disregarded.

@@ -145,10 +148,10 @@ the corresponding amounts applied in the second column.

Examples

applications = data.frame(time = seq(0, 14, by = 7), amount = c(1, 2, 3)) pred <- one_box(10) -plot(sawtooth(pred, applications = applications))
-m_2 <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
fit_2 <- mkinfit(m_2, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
pred_2 <- one_box(fit_2, ini = 1) +plot(sawtooth(pred, applications = applications))
+m_2 <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
fit_2 <- mkinfit(m_2, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
pred_2 <- one_box(fit_2, ini = 1) pred_2_saw <- sawtooth(pred_2, 2, 7) -plot(pred_2_saw, max_twa = 21, max_twa_var = "m1")
+plot(pred_2_saw, max_twa = 21, max_twa_var = "m1")
max_twa(pred_2_saw)
#> $max #> parent m1 #> 0.7834480 0.8617048 @@ -162,13 +165,10 @@ the corresponding amounts applied in the second column.

#> 21.00 47.85 #>
- @@ -179,7 +179,7 @@ the corresponding amounts applied in the second column.

-

Site built with pkgdown 1.4.1.

+

Site built with pkgdown 1.5.1.

diff --git a/man/TOXSWA_cwa.Rd b/man/TOXSWA_cwa.Rd index 6a95a0b..3daa1d0 100644 --- a/man/TOXSWA_cwa.Rd +++ b/man/TOXSWA_cwa.Rd @@ -1,6 +1,5 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/TOXSWA_cwa.R -\docType{class} \name{TOXSWA_cwa} \alias{TOXSWA_cwa} \title{R6 class for holding TOXSWA water concentration data and associated statistics} @@ -8,26 +7,12 @@ An \code{\link{R6Class}} generator object. } \description{ -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}}. +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}}. } -\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", @@ -41,12 +26,16 @@ print(H_sw_R1_stream) \section{Public fields}{ \if{html}{\out{
}} \describe{ -\item{\code{filename}}{Length one character vector.} +\item{\code{filename}}{Length one character vector holding the filename.} + +\item{\code{basedir}}{Length one character vector holding the directory where the file came from.} -\item{\code{basedir}}{Length one character vector.} +\item{\code{zipfile}}{If not null, giving the path to the zip file from which the file was read.} \item{\code{segment}}{Length one integer, specifying for which segment the cwa data were read.} +\item{\code{substance}}{The TOXSWA name of the substance.} + \item{\code{cwas}}{Dataframe holding the concentrations.} \item{\code{events}}{List of dataframes holding the event statistics for each threshold.} @@ -71,6 +60,7 @@ for the requested moving window sizes in days.} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-new}{}}} \subsection{Method \code{new()}}{ +Create a TOXSWA_cwa object from a file \subsection{Usage}{ \if{html}{\out{
}}\preformatted{TOXSWA_cwa$new( filename, @@ -82,29 +72,71 @@ for the requested moving window sizes in days.} )}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{filename}}{The filename} + +\item{\code{basedir}}{The directory to look in} + +\item{\code{zipfile}}{Optional path to a zipfile holding the file} + +\item{\code{segment}}{Either "last" or the number of the segment for which to read the data} + +\item{\code{substance}}{The TOXSWA substance name (for TOXSWA 4 or higher)} + +\item{\code{total}}{Should total concentrations be read in? If FALSE, free concentrations are read} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-moving_windows}{}}} \subsection{Method \code{moving_windows()}}{ +Add to the `windows` field described above. \subsection{Usage}{ \if{html}{\out{
}}\preformatted{TOXSWA_cwa$moving_windows(windows, total = FALSE)}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{windows}}{Window sizes in days} + +\item{\code{total}}{If TRUE, the total concentration including the amount adsorbed to +suspended matter will be used.} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-get_events}{}}} \subsection{Method \code{get_events()}}{ +Populate a datataframe with event information for the specified +threshold value. The resulting dataframe is stored in the `events` +field of the object. \subsection{Usage}{ \if{html}{\out{
}}\preformatted{TOXSWA_cwa$get_events(thresholds, total = FALSE)}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{thresholds}}{Threshold values in µg/L.} + +\item{\code{total}}{If TRUE, the total concentration including the amount adsorbed to +suspended matter will be used.} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-print}{}}} \subsection{Method \code{print()}}{ +Print a `TOXSWA_cwa` object \subsection{Usage}{ \if{html}{\out{
}}\preformatted{TOXSWA_cwa$print()}\if{html}{\out{
}} } -- cgit v1.2.1