Description Usage Arguments Details Value See Also Examples
Discretise the aggregated kinetic data, i.e. infer
discrete values from the curve parameters stored in an
OPMA
or OPMS
object. Here,
only discretisation into positive, negative and ambiguous
reactions is supported, and by default based on the
‘maximum height’ curve parameter (which is
biologically reasonable though).
1 2 3 4 5 6 7 8 9 | ## S4 method for signature 'MOPMX'
do_disc(object, ...)
## S4 method for signature 'OPMA'
do_disc(object, cutoff, groups = FALSE,
plain = FALSE, subset = opm_opt("disc.param"), unify = FALSE)
## S4 method for signature 'OPMS'
do_disc(object, cutoff = TRUE, groups = FALSE,
plain = FALSE, subset = opm_opt("disc.param"), unify = !length(cutoff),
...)
|
object |
|
cutoff |
Determines the discretisation approach. If
not |
groups |
List, Note that if The |
plain |
Logical scalar indicating whether or not an
|
subset |
Character scalar passed to
|
unify |
Logical or numeric scalar indicating whether
results should be unified per group. This works by
choosing the most frequent value (mode) if its frequency
is above a given threshold and If If See ‘Details’ below on the potential consequences
of unification. In the The |
... |
Optional arguments passed between the methods
or to |
If unify
is set to FALSE
, the
discretisation results are always consistent (in the
sense described for the OPMD
class) with
the discretised parameter. If unify
is set to
TRUE
this cannot be guaranteed any more. To
enforce consistency, use opm_opt(strict.OPMD =
TRUE)
.
The discretised values can be queried for using
has_disc
and received using
discretized
.
If plain
is FALSE
, an OPMD
or
OPMS
object. Otherwise a logical vector
whose length corresponds to the number of wells in
object
with an additional ‘settings’
attribute describing the run. The vector and its
attribute would correspond to the
discretized
and disc_settings
entries of a resulting OPMD
object,
respectively.
Other discretization-functions:
best_cutoff
, discrete
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | ## OPMA method
# arbitrary threshold, no ambiguity
summary(x <- do_disc(vaas_1, cutoff = 100))
stopifnot(has_disc(x), dim(x) == dim(vaas_1), !is.na(discretized(x)))
(y <- disc_settings(x)) # stored discretisation settings
stopifnot(identical(y$method, "direct"))
stopifnot(is.list(y), is.list(y$options)) # named lists
# arbitrary thresholds, allowing intermediate ('weak') reactions
summary(x <- do_disc(vaas_1, cutoff = c(75, 125)))
# the intermediate reactions are coded as NA
stopifnot(has_disc(x), dim(x) == dim(vaas_1), anyNA(discretized(x)))
(y <- disc_settings(x)) # stored discretisation settings
stopifnot(identical(y$method, "direct"))
stopifnot(is.list(y), is.list(y$options)) # named lists
# using k-means, two categories, no intermediate ('weak') reactions
summary(x <- do_disc(vaas_1, cutoff = FALSE))
stopifnot(has_disc(x), dim(x) == dim(vaas_1), !is.na(discretized(x)))
(y <- disc_settings(x)) # stored discretisation settings
stopifnot(identical(y$method, "kmeans"))
stopifnot(is.list(y), is.list(y$options)) # named lists
# using k-means, now allowing intermediate ('weak') reactions
summary(x <- do_disc(vaas_1, cutoff = TRUE))
stopifnot(has_disc(x), dim(x) == dim(vaas_1), any(discretized(x)))
(y <- disc_settings(x)) # stored discretisation settings
stopifnot(identical(y$method, "kmeans"))
stopifnot(is.list(y), is.list(y$options)) # named lists
## OPMS method
# arbitrary threshold, no ambiguity, no groups
x <- do_disc(vaas_4, cutoff = 100)
stopifnot(has_disc(x), dim(x) == dim(vaas_4), !is.na(discretized(x)))
(y <- disc_settings(x)[[1]]) # stored discretisation settings
stopifnot(identical(y$method, "direct"))
stopifnot(is.list(y), is.list(y$options)) # named lists
# arbitrary threshold, no ambiguity, no groups, with unification
x <- do_disc(vaas_4, cutoff = 100, unify = TRUE)
stopifnot(has_disc(x), dim(x) == dim(vaas_4))
stopifnot(anyNA(discretized(x))) # NAs caused by unification
(y <- disc_settings(x)[[1]]) # stored discretisation settings
stopifnot(identical(y$method, "direct"))
stopifnot(is.list(y), is.list(y$options)) # named lists
# all plates made uniform (makes not much sense)
# arbitrary threshold, no ambiguity, with groups, 1 plate per group
x <- do_disc(vaas_4, cutoff = 100, groups = TRUE)
stopifnot(has_disc(x), dim(x) == dim(vaas_4), !is.na(discretized(x)))
(y <- disc_settings(x)[[1]]) # stored discretisation settings
stopifnot(identical(y$method, "direct"))
stopifnot(is.list(y), is.list(y$options)) # named lists
# here, the plate numbers yield the group names
# arbitrary threshold, no ambiguity, with specified groups
x <- do_disc(vaas_4, cutoff = 100, groups = "Species")
stopifnot(has_disc(x), dim(x) == dim(vaas_4), !is.na(discretized(x)))
(y <- disc_settings(x)[[1]]) # stored discretisation settings
stopifnot(identical(y$method, "direct"))
stopifnot(is.list(y), is.list(y$options)) # named lists
# now, groups are from the metadata (but played no role)
# using k-means, no ambiguity, with specified groups
x <- do_disc(vaas_4, cutoff = FALSE, groups = "Species")
stopifnot(has_disc(x), dim(x) == dim(vaas_4), !is.na(discretized(x)))
(y <- disc_settings(x)[[1]]) # stored discretisation settings
stopifnot(identical(y$method, "kmeans"))
stopifnot(is.list(y), is.list(y$options)) # named lists
# grouping by species, discretised separately
# same, with unification
x <- do_disc(vaas_4, cutoff = FALSE, groups = "Species", unify = TRUE)
stopifnot(has_disc(x), dim(x) == dim(vaas_4))
stopifnot(anyNA(discretized(x))) # NAs caused by unification
(y <- disc_settings(x)[[1]]) # stored discretisation settings
stopifnot(identical(y$method, "kmeans"))
stopifnot(is.list(y), is.list(y$options)) # named lists
# grouping by species, discretised separately, then made uniform
# using best_cutoff(), groups defined by species affiliation (makes not
# much sense and by default yields warnings with these data)
x <- do_disc(vaas_4, cutoff = NULL, groups = "Species")
stopifnot(has_disc(x), dim(x) == dim(vaas_4), anyNA(discretized(x)))
(y <- disc_settings(x)[[1]]) # stored discretisation settings
stopifnot(identical(y$method, "best-cutoff"))
stopifnot(is.list(y), is.list(y$options)) # named lists
# groups as above, 2 strains per species, but some additional entries
# using best_cutoff(), single group for all plates (makes even less sense
# and by default also yields warnings with these data)
x <- do_disc(vaas_4, cutoff = NULL, groups = FALSE)
stopifnot(has_disc(x), dim(x) == dim(vaas_4), anyNA(discretized(x)))
(y <- disc_settings(x)[[1]]) # stored discretisation settings
stopifnot(identical(y$method, "best-cutoff"))
stopifnot(is.list(y), is.list(y$options)) # named lists
# no subgroups, all 4 data sets in one group, and some additional entries
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.