opms {opm}R Documentation

OPMS constructor

Description

Easily build OPMS (or MOPMX) objects.

Usage

  opms(..., precomputed = TRUE, skip = FALSE,
    group = FALSE)

Arguments

...

One to several objects which are either potentially nested lists of OPMS, OPM or OPMA objects, or really nested lists whose contained lists can be converted to an OPM or OPMA object.

precomputed

Logical scalar. If TRUE, contained lists have already been converted to one of the three classes. Otherwise, suitable contained lists will be converted.

skip

Logical scalar. If precomputed is TRUE, silently skip non-list elements of nested lists? If precomputed is FALSE, silently skip objects that do not belong to the three target classes? Otherwise, an error is generated if such a list element is encountered.

group

Logical or character scalar. If TRUE, split the list of collected OPM objects according to the plate type and convert the contained lists separately if they contain more than one plate; otherwise just keep the OPM object. FALSE is the default: all plates are tried to be forced into a single OPMS object. If a character scalar, the name of the plate type to be extracted.

Details

While otherwise rather flexible, this function will fail to return an OPMS object if group is set to FALSE and the plate types do not match (simply because such OPMS objects are disallowed). But if group is set to TRUE, a list (MOPMX object), not a single OPMS object will be returned; and if group is of mode ‘character’, this extracts the plate type(s) of interest.

Note that read_opm already has plate-type selection options.

Value

OPMS object, or list (MOPMX object) of such objects (and/or OPM objects), or OPM object, or NULL.

See Also

Other combination-functions: $<-, [<-, [[<-, c, plus

Examples

## Testing distinct OPM/OPMS combinations -- all should work.
## Note the number of contained plates in the generated objects.

(x <- opms()) # 0 objects
## NULL
stopifnot(is.null(x))
(x <- opms(group = TRUE)) # 0 also objects
## [1] Length      Plate.type  Aggregated  Discretized
## <0 rows> (or 0-length row.names)
## 
## => MOPMX object with 0 element(s), details are shown above.
##  Access the elements with [[ or $ to apply specific methods.
stopifnot(is(x, "MOPMX"), length(x) == 0)

dim(x <- opms(vaas_1)) # 1 object
## [1] 384  96
stopifnot(identical(x, vaas_1))
dim(x <- opms(vaas_4, group = plate_type(vaas_4)))
## [1]   4 384  96
stopifnot(identical(x, vaas_4))
dim(x <- opms(vaas_4, group = "PM01"))
## NULL
stopifnot(is.null(x)) # no such plate type => empty object!

dim(x <- opms(vaas_1, vaas_1)) # 2 objects
## [1]   2 384  96
stopifnot(is(x, "OPMS"), length(x) == 2L)
dim(x <- opms(vaas_4, vaas_1))
## [1]   5 384  96
stopifnot(is(x, "OPMS"), length(x) == 5L)
dim(x <- opms(vaas_1, vaas_4))
## [1]   5 384  96
stopifnot(is(x, "OPMS"), length(x) == 5L)
dim(x <- opms(vaas_4, vaas_4))
## [1]   8 384  96
stopifnot(is(x, "OPMS"), length(x) == 8L)

[Package opm version 1.3.63 Index]