View source: R/MultiFactor-constructors.R
MultiFactor | R Documentation |
MultiFactor
is an S4 class to organize and manage multiple sets of factors,
for instance when tracing or converting feature IDs across databases. Methods
for MultiFactor
aim to follow factor
behaviour.
show
: Display the object
Analogous to factors
. droplevels(MultiFactor)
returns a
MultiFactor
with unused levels removed.
get object levels
## Constructor for `MultiFactor` objects
MultiFactor(x, levels = NULL, drop.unmatched = TRUE)
asMultiFactor(x, levels = NULL, drop.unmatched = TRUE)
## Accessors
## S4 method for signature 'MultiFactor'
dimnames(x)
## S4 method for signature 'MultiFactor'
dim(x)
## S4 method for signature 'MultiFactor'
names(x)
## S4 method for signature 'MultiFactor'
dictionary(x, ...)
## S4 replacement method for signature 'MultiFactor'
dictionary(x, ...) <- value
## Factor manipulation
## S4 method for signature 'MultiFactor'
levels(x)
## S4 method for signature 'MultiFactor'
unfactor(x)
## S4 method for signature 'MultiFactor'
droplevels(x, exclude = NULL, select = NULL, ...)
## Subsetting
## S4 method for signature 'MultiFactor,ANY,ANY'
x[i, j, ..., drop = TRUE]
## S4 replacement method for signature 'MultiFactor,ANY,ANY,list'
x[i, j, ...] <- value
## S4 method for signature 'MultiFactor,ANY'
x[[i, ...]]
## S4 replacement method for signature 'MultiFactor,ANY,ANY'
x[[i, ...]] <- value
## S4 method for signature 'MultiFactor'
subset(x, subset, select, ...)
## Combining
## S4 method for signature 'MultiFactor'
c(x, ...)
## Coercion
## S4 method for signature 'MultiFactor'
as.list(x, ..., use.names = TRUE)
## S4 method for signature 'MultiFactor'
getEdgeList(x)
## S4 method for signature 'MultiFactor'
show(object)
## S4 method for signature 'MultiFactor'
as.list(x, ..., use.names = TRUE)
## S3 method for class 'MultiFactor'
as.list(x, ..., use.names = TRUE)
x , object |
|
levels |
an optional named list of vectors of the unique values (as character strings) that x might have taken. The default is the unique set of values taken by lapply(x, as.character), sorted into increasing order of x. |
drop.unmatched |
|
i , j , ... |
indices specifying elements to extract or replace. Indices are numeric or character vectors or empty (missing) or NULL. Numeric values are coerced to integer or whole numbers as by as.integer or for large values by trunc (and hence truncated towards zero). Character vectors will be matched to the names of the object. |
drop |
Whether to return a |
value |
a replacement character vector of suitable dimensions. |
exclude |
|
select |
|
subset |
|
use.names |
|
The most straightforward way to construct a MultiFactor
object is as a
named list of named data.frames. The columns of the data.frames indicate the
category of factor in that column.
A MultiFactor
object presents itself similar to a data.frame
, in the
sense that level types can be called as columns and individual data.frame
components can be called as rows.
Only one of select
and exclude
should be provided, as they are
each others complement.
A MultiFactor
a named list of character vectors.
a named list of character vectors (Default) or integers
(use.names = FALSE
).
index
Named list
of named integer data frames of at least two columns
each. The column names correspond to names in the levels
slot. Similar
to factor
s, the integers in those columns correspond to the characters
in that level. Accessed through regular list methods (e.g., [
, [[
).
levels
Named list of character vectors
. Accessed through levels(x)
map
(sparse)Matrix
specifying which elements contain which levels.
Accesses through dictionary(x)
.
kegg_link()
: for an example of valid input.
BiocGenerics::subset()
.
weaveWeb()
for the AnansiWeb constructor functions that
take link data frames.
unfactor()
# prep input
l <- asMultiFactor(kegg_link())
# Sub-setting is only performed on data frames that contain the arguments
str(subset(x = l, cpd %in% c("C00001", "C00002")))
# Several data frames at the same time:
subset(x = l, ec %in% c("1.2.3.4", "4.3.2.1"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.