Description Usage Arguments Details Value Examples
Search for the presence of metadata values for given
keys, either using a vector, factor, list, formula,
expression or WMD
object.
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 | ## S4 method for signature 'ANY,MOPMX'
x %Q% table
## S4 method for signature 'MOPMX,ANY'
x %Q% table
## S4 method for signature 'MOPMX,MOPMX'
x %Q% table
## S4 method for signature 'MOPMX,WMD'
x %Q% table
## S4 method for signature 'MOPMX,WMDS'
x %Q% table
## S4 method for signature 'WMD,ANY'
x %Q% table
## S4 method for signature 'WMD,MOPMX'
x %Q% table
## S4 method for signature 'WMD,WMD'
x %Q% table
## S4 method for signature 'WMD,WMDS'
x %Q% table
## S4 method for signature 'WMDS,ANY'
x %Q% table
## S4 method for signature 'WMDS,MOPMX'
x %Q% table
## S4 method for signature 'character,WMD'
x %Q% table
## S4 method for signature 'character,WMDS'
x %Q% table
## S4 method for signature 'expression,WMD'
x %Q% table
## S4 method for signature 'expression,WMDS'
x %Q% table
## S4 method for signature 'factor,WMD'
x %Q% table
## S4 method for signature 'factor,WMDS'
x %Q% table
## S4 method for signature 'formula,WMD'
x %Q% table
## S4 method for signature 'formula,WMDS'
x %Q% table
## S4 method for signature 'list,WMD'
x %Q% table
## S4 method for signature 'list,WMDS'
x %Q% table
## S4 method for signature 'ANY,MOPMX'
x %q% table
## S4 method for signature 'MOPMX,ANY'
x %q% table
## S4 method for signature 'MOPMX,MOPMX'
x %q% table
## S4 method for signature 'MOPMX,WMD'
x %q% table
## S4 method for signature 'MOPMX,WMDS'
x %q% table
## S4 method for signature 'WMD,ANY'
x %q% table
## S4 method for signature 'WMD,MOPMX'
x %q% table
## S4 method for signature 'WMD,WMD'
x %q% table
## S4 method for signature 'WMD,WMDS'
x %q% table
## S4 method for signature 'WMDS,ANY'
x %q% table
## S4 method for signature 'WMDS,MOPMX'
x %q% table
## S4 method for signature 'character,WMD'
x %q% table
## S4 method for signature 'character,WMDS'
x %q% table
## S4 method for signature 'expression,WMD'
x %q% table
## S4 method for signature 'expression,WMDS'
x %q% table
## S4 method for signature 'factor,WMD'
x %q% table
## S4 method for signature 'factor,WMDS'
x %q% table
## S4 method for signature 'formula,WMD'
x %q% table
## S4 method for signature 'formula,WMDS'
x %q% table
## S4 method for signature 'list,WMD'
x %q% table
## S4 method for signature 'list,WMDS'
x %q% table
|
x |
Character vector, factor, list, formula,
expression or |
table |
|
The behaviour of these methods depends on the object used
as query. infix.largeq
is usually stricter than
infix.q
, sometimes equivalent.
Using a character vector as query, this tests
whether all given query keys are present in the top-level
names of the metadata and refer to the same query
elements. The names
of the vector are used to
select elements from the top level of the metadata. When
using infix.q
, these elements are then converted
to ‘character’ mode before comparison with the
values of x
. A non-empty vector without a
names
attribute is accepted but will always yield
FALSE
. In contrast, an entirely empty vector
yields TRUE
.
Using a list, a non-exact query with a query list
is conducted. The comparison is applied recursively
using contains
with the values
argument set to TRUE
and exact
set to
either FALSE
(infix.q
) or TRUE
(infix.largeq
). The latter might be too strict for
most applications. The main advantage of using a list
over the character-based search is that it allows for a
nested query.
When supplying a WMD
object as query,
its metadata will be used in a list query.
The factor method first converts x
to
‘character’ mode.
The formula method attempts to evaluate the right
side of the formula in the context of the metadata of
table
and returns the result. For the
WMD
method, it is up to the user to ensure
that the result is a logical scalar, but the method would
succeed anyway. The WMDS
method yields an
error unless each plate yields a logical scalar. Symbols
that are not found within the metadata are looked up in
the enclosing environment (infix.q
) or only in the
base environment (infix.largeq
). The former
approach is less strict. Because of missing objects and
other reasons the method might nevertheless fail.
The expression method works like the formula method, using the entire expression in place of the right side of the formula.
See subset
for usage
examples with OPMS
objects.
Logical vector of the length of the WMD
or
WMDS
object. For MOPMX
objects, a list of such vectors.
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 | # The data set vaas_1 contains the metadata keys 'Species' and 'Experiment'
# with the values 'Escherichia coli' and 'First replicate'.
## Character methods
stopifnot(!"Experiment" %q% vaas_1) # wrong query here; compare to %k%
stopifnot(!"First replicate" %q% vaas_1) # again wrong query
stopifnot(c(Experiment = "First replicate") %q% vaas_1) # correct query
stopifnot(c(Experiment = "First replicate") %Q% vaas_1)
stopifnot(!"Species" %q% vaas_1) # wrong query
stopifnot(!"Escherichia coli" %q% vaas_1) # wrong query
stopifnot(c(Species = "Escherichia coli") %q% vaas_1) # correct query
# This does not work because the value has the wrong type
stopifnot(!c(`Plate number` = "6") %Q% vaas_1)
# Compare to %q%
stopifnot(c(`Plate number` = "6") %q% vaas_1)
stopifnot(c(Species = "Escherichia coli",
Experiment = "First replicate") %q% vaas_1) # combined query, all TRUE
stopifnot(c(Species = "Escherichia coli",
Experiment = "First replicate") %Q% vaas_1) # all present
stopifnot(character() %q% vaas_1) # empty query always results
stopifnot(character() %Q% vaas_1)
## List methods
stopifnot(list(Experiment = "First replicate") %q% vaas_1)
stopifnot(list(Experiment = "First replicate") %Q% vaas_1) # present
# Choice among alternatives
stopifnot(list(Experiment = c("First replicate",
"Second replicate")) %q% vaas_1) # one of them TRUE
stopifnot(!list(Experiment = c("Second replicate",
"Third replicate")) %q% vaas_1) # none of them TRUE
# Combined query together with choice among alternatives
stopifnot(list(Experiment = c("First replicate", "Second replicate"),
Species = c("Escherichia coli", "Bacillus subtilis")) %q% vaas_1)
# Choice among alternatives is not done here: this query fails unless this
# two-element vector is contained. Compare to %q%.
stopifnot(!list(Experiment = c("First replicate",
"Second replicate")) %Q% vaas_1)
stopifnot(list() %q% vaas_1) # empty query always results
stopifnot(list() %Q% vaas_1)
stopifnot(vaas_1 %q% vaas_1) # obviously
stopifnot(vaas_1 %Q% vaas_1)
## Formulae for querying
stopifnot((~ Experiment == "First replicate") %q% vaas_1)
stopifnot((~ Experiment == "First replicate") %Q% vaas_1)
stopifnot(vaas_1 %q% ~ Experiment == "First replicate")
stopifnot(vaas_1 %Q% ~ Experiment == "First replicate")
stopifnot(vaas_1 %q% ~ Species == "Escherichia coli")
stopifnot(vaas_1 %Q% ~ Species == "Escherichia coli")
stopifnot(vaas_1 %q% ~ Species != "Bacillus subtilis")
stopifnot(vaas_1 %Q% ~ Species != "Bacillus subtilis")
x <- try(vaas_1 %q% ~ missing.name == "abc", silent = TRUE) # fails
stopifnot(inherits(x, "try-error"))
x <- try(vaas_1 %Q% ~ missing.name == "abc", silent = TRUE) # also fails
stopifnot(inherits(x, "try-error"))
missing.name <- "abc" # enclosing environment considered or ignored
stopifnot(vaas_1 %q% ~ missing.name == "abc")
x <- try(vaas_1 %Q% ~ missing.name == "abc", silent = TRUE) # still fails
stopifnot(inherits(x, "try-error"))
rm(missing.name) # tidy up
# examples for OPMS methods are given under subset()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.