jranke / pfm
Showing 3 of 15 files from the diff.
Newly tracked file
R/TOXSWA_cwa.R changed.
Newly tracked file
R/endpoint.R changed.
Newly tracked file
R/GUS.R changed.
Other files ignored by Codecov

@@ -142,35 +142,24 @@
Loading
142 142
143 143
#' R6 class for holding TOXSWA water concentration data and associated statistics
144 144
#'
145 -
#' An R6 class for holding TOXSWA water concentration (cwa) data and some associated statistics.
146 -
#' Usually, an instance of this class will be generated by \code{\link{read.TOXSWA_cwa}}.
145 +
#' @description An R6 class for holding TOXSWA water concentration (cwa) data
146 +
#' and some associated statistics.  like maximum moving window average
147 +
#' concentrations, and dataframes holding the events exceeding specified
148 +
#' thresholds.  Usually, an instance of this class will be generated
149 +
#' by \code{\link{read.TOXSWA_cwa}}.
147 150
#'
148 -
#' @docType class
149 -
#' @importFrom R6 R6Class
150 151
#' @export
151 152
#' @format An \code{\link{R6Class}} generator object.
152 -
#' @field filename Length one character vector.
153 -
#' @field basedir Length one character vector.
153 +
#' @field filename Length one character vector holding the filename.
154 +
#' @field basedir Length one character vector holding the directory where the file came from.
155 +
#' @field zipfile If not null, giving the path to the zip file from which the file was read.
154 156
#' @field segment Length one integer, specifying for which segment the cwa data were read.
157 +
#' @field substance The TOXSWA name of the substance.
155 158
#' @field cwas Dataframe holding the concentrations.
156 159
#' @field events List of dataframes holding the event statistics for each threshold.
157 160
#' @field windows Matrix of maximum time weighted average concentrations (TWAC_max)
158 161
#'   and areas under the curve in µg/day * h (AUC_max_h) or µg/day * d (AUC_max_d)
159 162
#'   for the requested moving window sizes in days.
160 -
#' @section Methods:
161 -
#' \describe{
162 -
#'   \item{\code{get_events(threshold, total = FALSE)}}{
163 -
#'         Populate a datataframe with event information for the specified threshold value
164 -
#'         in µg/L. If \code{total = TRUE}, the total concentration including the amount
165 -
#'         adsorbed to suspended matter will be used. The resulting dataframe is stored in the
166 -
#'         \code{events} field of the object.
167 -
#'         }
168 -
#'   \item{\code{moving_windows(windows, total = FALSE)}}{
169 -
#'         Add to the \code{windows} field described above.
170 -
#'         Again, if \code{total = TRUE}, the total concentration including the amount
171 -
#'         adsorbed to suspended matter will be used.
172 -
#'         }
173 -
#' }
174 163
#' @examples
175 164
#' H_sw_R1_stream  <- read.TOXSWA_cwa("00003s_pa.cwa",
176 165
#'                                  basedir = "SwashProjects/project_H_sw/TOXSWA",
@@ -180,7 +169,6 @@
Loading
180 169
#' H_sw_R1_stream$moving_windows(c(7, 21))
181 170
#' print(H_sw_R1_stream)
182 171
#' @keywords data
183 -
184 172
TOXSWA_cwa <- R6Class("TOXSWA_cwa",
185 173
  public = list(
186 174
    filename = NULL,
@@ -191,6 +179,15 @@
Loading
191 179
    cwas = NULL,
192 180
    windows = NULL,
193 181
    events = list(),
182 +
183 +
    #' @description
184 +
    #' Create a TOXSWA_cwa object from a file
185 +
    #' @param filename The filename
186 +
    #' @param basedir The directory to look in
187 +
    #' @param zipfile Optional path to a zipfile holding the file
188 +
    #' @param segment Either "last" or the number of the segment for which to read the data
189 +
    #' @param substance The TOXSWA substance name (for TOXSWA 4 or higher)
190 +
    #' @param total Should total concentrations be read in? If FALSE, free concentrations are read
194 191
    initialize = function(filename, basedir, zipfile = NULL,
195 192
                          segment = "last", substance = "parent", total = FALSE) {
196 193
      self$filename <- filename
@@ -327,6 +324,12 @@
Loading
327 324
        }
328 325
      }
329 326
    },
327 +
328 +
    #' @description
329 +
    #' Add to the `windows` field described above.
330 +
    #' @param windows Window sizes in days
331 +
    #' @param total If TRUE, the total concentration including the amount adsorbed to
332 +
    #' suspended matter will be used.
330 333
    moving_windows = function(windows, total = FALSE) {
331 334
      window_names = paste(windows, "days")
332 335
      n = length(window_names)
@@ -350,6 +353,14 @@
Loading
350 353
      }
351 354
      invisible(self)
352 355
    },
356 +
357 +
    #' @description
358 +
    #' Populate a datataframe with event information for the specified
359 +
    #' threshold value.  The resulting dataframe is stored in the `events`
360 +
    #' field of the object.
361 +
    #' @param thresholds Threshold values in µg/L.
362 +
    #' @param total If TRUE, the total concentration including the amount adsorbed to
363 +
    #' suspended matter will be used.
353 364
    get_events = function(thresholds, total = FALSE) {
354 365
      if (missing(thresholds)) {
355 366
        stop("You need to specify at least one threshold concentration in \u03bcg/L")
@@ -397,6 +408,9 @@
Loading
397 408
      }
398 409
      invisible(self)
399 410
    },
411 +
412 +
    #' @description
413 +
    #' Print a `TOXSWA_cwa` object
400 414
    print = function() {
401 415
      cat("<TOXSWA_cwa> data from file", self$filename, "segment", self$segment, "\n")
402 416
      print(head(self$cwas))

@@ -55,7 +55,6 @@
Loading
55 55
  else return(signif(aggregator(as.numeric(values)), signif))
56 56
}
57 57
58 -
#' @inheritParams endpoint
59 58
#' @rdname endpoint
60 59
#' @export
61 60
soil_DT50 <- function(chent, aggregator = geomean, signif = 3, 
@@ -68,7 +67,6 @@
Loading
68 67
  return(ep)
69 68
}
70 69
71 -
#' @inheritParams endpoint
72 70
#' @rdname endpoint
73 71
#' @export
74 72
soil_Kfoc <- function(chent, aggregator = geomean, signif = 3, 
@@ -79,7 +77,6 @@
Loading
79 77
  return(ep)
80 78
}
81 79
82 -
#' @inheritParams endpoint
83 80
#' @rdname endpoint
84 81
#' @export
85 82
soil_N <- function(chent, aggregator = mean, signif = 3, raw = FALSE) {
@@ -89,7 +86,6 @@
Loading
89 86
  return(ep)
90 87
}
91 88
92 -
#' @inheritParams endpoint
93 89
#' @rdname endpoint
94 90
#' @param values The values to be returned
95 91
#' @param aggregators A named vector of aggregator functions to be used

@@ -7,7 +7,6 @@
Loading
7 7
#' @references Gustafson, David I. (1989) Groundwater ubiquity score: a simple
8 8
#' method for assessing pesticide leachability. \emph{Environmental
9 9
#' toxicology and chemistry} \bold{8}(4) 339–57.
10 -
#' @inheritParams endpoint
11 10
#' @param DT50 Half-life of the chemical in soil. Should be a field
12 11
#'   half-life according to Gustafson (1989). However, leaching to the sub-soil
13 12
#'   can not completely be excluded in field dissipation experiments and Gustafson
Files Coverage
R 68.80%
Project Totals (17 files) 68.80%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading