measurements {opm} | R Documentation |
Return the measurements, optionally only from selected wells and with or without the time points, or only the time points.
## S4 method for signature 'MOPMX' hours(object, ...) ## S4 method for signature 'OPM' hours(object, what = c("max", "all", "size", "summary", "interval", "minmax")) ## S4 method for signature 'OPMS' hours(object, ...) ## S4 method for signature 'MOPMX' measurements(object, ...) ## S4 method for signature 'OPM' measurements(object, i, logt0 = FALSE) ## S4 method for signature 'OPMS' measurements(object, ...) ## S4 method for signature 'MOPMX' well(object, ...) ## S4 method for signature 'OPM' well(object, i, drop = TRUE, use.names = TRUE) ## S4 method for signature 'OPMS' well(object, ...)
object |
|
i |
Optional character or numeric vector with
name(s) or position(s) of well(s). Wells are originally
named ‘A01’ to ‘H12’ but might have been
subset beforehand. |
logt0 |
Logical scalar. Treat the data like cell
counts and calculate |
drop |
Logical scalar. If only a single well was selected, simplify it to a vector? |
use.names |
Logical scalar indicating whether the time points should be used as names for the measurements. |
what |
Character scalar determining the output mode as follows:
|
... |
Optional arguments passed between the methods. |
measurements
returns a numeric matrix with column
names indicating the well coordinate and a first column
containing the time points. The other columns contain the
values from each well. There is one row per time point.
Column names are appropriately set, but not translated
(as, e.g., to substrate names). It is possible to select
wells, but the time points are always included as first
column (in contrast to well
). The i
argument refers only to the remaining matrix.
Do not confuse well
with wells
.
well
yields a numeric matrix or vector, depending
on i
and drop
. It will always ignore the
time points as values, in contrast to
measurements
. But depending on use.names
they would be inserted as names.
The return value of hours
is dependent on the
what
argument; see there.
For quickly obtaining an overview of the running times in
a MOPMX
object see extract
and heat_map
.
Other getter-functions: aggr_settings
,
aggregated
, anyDuplicated
,
anyNA
, contains
,
csv_data
, dim
,
disc_settings
, discretized
,
duplicated
, has_aggr
,
has_disc
, max
,
minmax
, seq
,
subset
, thin_out
# 'OPM' methods
head(x <- measurements(vaas_1))[, 1:5] # => numeric matrix
## Hour A01 A02 A03 A04
## [1,] 0.00 40 68 23 28
## [2,] 0.25 40 52 21 29
## [3,] 0.50 32 47 19 30
## [4,] 0.75 34 48 19 29
## [5,] 1.00 35 49 21 30
## [6,] 1.25 35 47 19 30
stopifnot(is.matrix(x), is.numeric(x))
stopifnot(dim(x) == c(384, 97))
head(x <- measurements(vaas_1, "B03"))
## Hour B03
## [1,] 0.00 16
## [2,] 0.25 17
## [3,] 0.50 13
## [4,] 0.75 13
## [5,] 1.00 14
## [6,] 1.25 15
stopifnot(is.matrix(x), is.numeric(x), dim(x) == c(384, 2))
head(y <- measurements(vaas_1, ~ B03)) # => same result with formula
## Hour B03
## [1,] 0.00 16
## [2,] 0.25 17
## [3,] 0.50 13
## [4,] 0.75 13
## [5,] 1.00 14
## [6,] 1.25 15
stopifnot(identical(y, x))
head(x <- well(vaas_1, "B04")) # => numeric vector
## 0 0.25 0.5 0.75 1 1.25
## 18 29 24 26 26 25
stopifnot(is.numeric(x), length(x) == 384)
head(x <- well(vaas_1, c("B08", "C07"))) # => numeric matrix
## B08 C07
## 0 19 11
## 0.25 26 11
## 0.5 32 11
## 0.75 35 11
## 1 29 11
## 1.25 28 11
stopifnot(is.matrix(x), dim(x) == c(384, 2))
# selecting adjacent wells is easer when using a formula
head(x <- well(vaas_1, c("B12", "C01", "C02")))
## B12 C01 C02
## 0 78 25 20
## 0.25 40 27 23
## 0.5 50 22 21
## 0.75 50 25 20
## 1 49 24 18
## 1.25 41 24 17
stopifnot(is.matrix(x), dim(x) == c(384, 3))
head(y <- well(vaas_1, ~ B12:C02)) # => same result
## B12 C01 C02
## 0 78 25 20
## 0.25 40 27 23
## 0.5 50 22 21
## 0.75 50 25 20
## 1 49 24 18
## 1.25 41 24 17
stopifnot(identical(x, y))
(x <- hours(vaas_1)) # the default is 'max'
## [1] 95.75
stopifnot(identical(x, 95.75))
(x <- hours(vaas_1, "minmax"))
## [1] 95.75
stopifnot(identical(x, 95.75))
(x <- hours(vaas_1, "summary"))
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00 23.94 47.88 47.88 71.81 95.75
stopifnot(is.table(x))
(x <- hours(vaas_1, "interval"))
## [1] 0.25
stopifnot(identical(x, 0.25))
(x <- hours(vaas_1, "size"))
## [1] 384
stopifnot(identical(x, 384L))
# 'OPMS' methods
summary(x <- measurements(vaas_4)) # => list of numeric matrices
## Length Class Mode
## [1,] 37248 -none- numeric
## [2,] 37248 -none- numeric
## [3,] 37248 -none- numeric
## [4,] 37248 -none- numeric
stopifnot(is.list(x), length(x) == length(vaas_4))
stopifnot(sapply(x, is.matrix), sapply(x, is.numeric))
head(x <- well(vaas_4, "B04"))[, 1:5] # => numeric matrix
## 0 0.25 0.5 0.75 1
## [1,] 11 11 11 11 11
## [2,] 18 29 24 26 26
## [3,] 29 42 29 24 23
## [4,] 14 12 11 13 14
stopifnot(is.matrix(x), dim(x) == c(4, 384))
head(y <- well(vaas_4, ~ B04))[, 1:5] # using a formula
## 0 0.25 0.5 0.75 1
## [1,] 11 11 11 11 11
## [2,] 18 29 24 26 26
## [3,] 29 42 29 24 23
## [4,] 14 12 11 13 14
stopifnot(identical(x, y)) # => same result
(x <- hours(vaas_4)) # all with the same overall running time
## [1] 95.75 95.75 95.75 95.75
stopifnot(length(x) == 4, x == 95.75)