plates {opm} | R Documentation |
Get all plates
contained in an OPMS
object or a list, or create a list containing a single
OPM
object as element, or apply a function
to a collection of OPM
objects.
## S4 method for signature 'MOPMX' oapply(object, fun, ..., simplify = TRUE) ## S4 method for signature 'OPM' oapply(object, fun, ..., simplify = TRUE) ## S4 method for signature 'OPMS' oapply(object, fun, ..., simplify = TRUE) ## S4 method for signature 'MOPMX' plates(object) ## S4 method for signature 'WMD' plates(object) ## S4 method for signature 'WMDS' plates(object) ## S4 method for signature 'list' plates(object)
object |
|
fun |
A function. Should accept an |
... |
Optional other arguments passed to
|
simplify |
Logical scalar. If |
The list method of plates
traverses the input
recursively and skips all objects of other classes than
OPM
. See also opms
, which is
somewhat similar but more flexible.
oapply
applies a function to all OPM
objects within an OPMS
object. Optionally
it simplifies the result to an OPMS
object
if possible, or other structures simpler than a list. The
OPM
method of oapply
simply applies
fun
once (to object
).
For plates
, a list of OPM
objects
(may be empty instead if object
is a list). The
result of oapply
depends on fun
and
simplify
: a list, vector, matrix or
OPMS
object are possible outcomes.
base::list base::as.list base::sapply
Other conversion-functions: as.data.frame
,
extract
, extract_columns
,
flatten
, merge
,
opmx
, rep
, rev
,
sort
, split
,
to_yaml
, unique
# plates(), 'OPM' method summary(x <- plates(vaas_1)) # => list of OPM objects stopifnot(is.list(x), length(x) == 1L, sapply(x, inherits, what = "OPM")) # plates(), 'OPMS' method summary(x <- plates(vaas_4)) # => list of OPM objects stopifnot(is.list(x), length(x) == 4L, sapply(x, inherits, what = "OPM")) # plates(), list method x <- list(vaas_1, letters, vaas_4, 1:10) summary(x <- plates(x)) # => list of OPM objects stopifnot(is.list(x), length(x) == 5, sapply(x, inherits, what = "OPM")) ## oapply() summary(x <- oapply(vaas_4, identity)) # trivial stopifnot(identical(x, vaas_4)) summary(x <- oapply(vaas_4, identity, simplify = FALSE)) # => yields list stopifnot(is.list(x), length(x) == 4, sapply(x, class) == "OPMD")