aggregated: Get aggregated data

Description Usage Arguments Details Value See Also Examples

Description

Get the aggregated kinetic data or the aggregation settings used. (See do_aggr for generating aggregated data.)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
  ## S4 method for signature 'MOPMX'
aggr_settings(object, join = NULL) 
  ## S4 method for signature 'OPMA'
aggr_settings(object, join = NULL) 
  ## S4 method for signature 'OPMS'
aggr_settings(object, join = NULL) 

  ## S4 method for signature 'MOPMX'
aggregated(object, ...) 
  ## S4 method for signature 'OPMA'
aggregated(object, subset = NULL, ci = TRUE,
    trim = c("no", "full", "medium"), full = FALSE, in.parens = TRUE,
    max = opm_opt("max.chars"), ...) 
  ## S4 method for signature 'OPMS'
aggregated(object, ...) 

Arguments

object

OPMA, OPMS or MOPMX object.

subset

Character vector. If not NULL, restrict to this or these parameter(s). See param_names for the possible values.

ci

Logical scalar. Include the estimates of confidence intervals (CIs) in the output?

trim

Character scalar. Parameter estimates from intrinsically negative reactions (i.e., no respiration) are sometimes biologically unreasonable because they are too large or too small, and some corrections might be appropriate.

no

No modification.

full

Negative lambda estimates are set to zero.

medium

Lambda estimates larger than hours(object) (i.e., the maximum time value observed) are set to that value. Negative lambda estimates smaller than -hours(object) are set to this value (i.e., the negative maximum time).

full

Like ‘medium’, but all negative values are set to zero, which is a less moderate treatment.

Currently the other parameters are not checked, and all NA values, if any, also remain unchanged.

full

Logical scalar passed to wells. This and the following arguments affect the column names of the resulting matrix.

in.parens

Logical scalar also passed to that function.

max

Numeric scalar also passed to that function.

join

Empty or character scalar. If empty, a list is returned; a nested list in the case of OPMS objects with one contained list per plate. Otherwise this nested list is converted to a matrix or data frame, depending on the value of join. The following values yield a matrix in character mode and differ in how they would convert non-scalar values in a matrix in list mode, if encountered:

json

Converts to a JSON string.

yaml

Converts to a YAML string.

rcode

Converts by deparsing, yielding an R code string.

All other values of join are passed as what argument to the collect method form the pkgutils package, with dataframe and keep.unnamed set to TRUE but stringsAsFactors to FALSE.

...

Optional arguments passed between the methods or to wells.

Details

Note that the conversion of the settings list to a matrix or data frame might not work for all combinations of object and join, mainly because the options entry can hold arbitrary content. For similar conversions of the metadata, see the OPMX methods of to_metadata.

Value

aggregated yields a numeric matrix of aggregated values (a.k.a. the curve parameters). If bootstrapping was used, their CIs are included. The columns represent the wells, the rows the estimated parameters and their CIs.

aggr_settings returns a named list if join is empty. Other values yield a matrix or data frame (or an error). See the description of the argument above and the examples below for further details.

See Also

Other getter-functions: anyDuplicated, anyNA, contains, csv_data, dim, disc_settings, discretized, duplicated, has_aggr, has_disc, hours, max, measurements, minmax, seq, subset, thin_out, well

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 'OPMA' methods
# Get full matrix
(x <- aggregated(vaas_1))[, 1:3]
stopifnot(is.matrix(x), dim(x) == c(12, 96))
(y <- aggregated(vaas_1, full = TRUE))[, 1:3] # full names
stopifnot(x == y, nchar(colnames(x)) < nchar(colnames(y)))
# Subsetting
(x <- aggregated(vaas_1, "lambda"))[, 1:3]
stopifnot(is.matrix(x), dim(x) == c(3, 96), any(x < 0))
# Now with lambda correction
(x <- aggregated(vaas_1, "lambda", trim = "full"))[, 1:3]
stopifnot(is.matrix(x), dim(x) == c(3, 96), !any(x < 0))

# settings
(x <- aggr_settings(vaas_1)) # yields named list
stopifnot(is.list(x), !is.null(names(x)))
(x <- aggr_settings(vaas_1, join = "json")) # yields a matrix
stopifnot(is.matrix(x), is.character(x), nrow(x) == 1)

# 'OPMS' methods
summary(x <- aggregated(vaas_4)) # => one matrix per OPM object
stopifnot(is.list(x), length(x) == length(vaas_4), sapply(x, is.matrix))

# settings
summary(x <- aggr_settings(vaas_4)) # list of named lists, one per plate
stopifnot(is.list(x), length(x) == length(vaas_4), sapply(x, is.list))
(x <- aggr_settings(vaas_4, join = "yaml")) # matrix, one row per plate
stopifnot(is.matrix(x), is.character(x), nrow(x) == 4)

opm documentation built on May 2, 2019, 6:08 p.m.