| as_matrixset {matrixset} | R Documentation |
Coerce object into matrixset
Description
Turns object into a matrixset. See specific methods for more details
Usage
as_matrixset(
x,
expand = NULL,
row_info = NULL,
column_info = NULL,
row_key = "rowname",
column_key = "colname",
row_tag = ".rowname",
column_tag = ".colname"
)
Arguments
x |
an object to coerce to |
expand |
By default ( |
row_info |
a data frame, used to annotate matrix rows. The link
between the matrix row names and the data frame is given
in column "rowname". A different column can be used if one
provides a different |
column_info |
a data frame, used to annotate matrix columns. The link
between the matrix column names and the data frame is given
in column "colname". A different column can be used if one
provides a different |
row_key |
column name in |
column_key |
column name in |
row_tag |
A string, giving the row annotation data frame column that
will link the row names to the data frame. While
|
column_tag |
A string, giving the column annotation data frame column
that will link the row names to the data frame. While
|
Value
Returns a matrixset - see matrixset().
Methods
-
matrixThe
matrixmethod is very similar to calling thematrixsetconstruction function, with some key differences:A matrix name will be provided automatically by
as_matrixset. The name is "..1".Because only matrix is provided, the
expandargument is not available
-
listThe
listmethod is nearly identical to calling thematrixsetconstruction function. It only differs in that unnamedlistelement will be padded with a name. The new padded names are the element index, prefixed by "..". Already existing names will be made unique as well. If name modification needs to be performed, a warning will be issued.
Examples
# We're showing how 'as_matrixset' can differ. But first, show how they can
# yield the same result. Note that the list is named
lst <- list(a = matrix(1:6, 2, 3), b = matrix(101:106, 2, 3))
identical(matrixset(lst), as_matrixset(lst))
# Now it will differ: the list is unnamed. In fact, 'matrixset' will fail
lst <- list(matrix(1:6, 2, 3), matrix(101:106, 2, 3))
is(try(matrixset(lst), silent = TRUE), "try-error")
as_matrixset(lst)
# You need to name the matrix to use 'matrixset'. A name is provided for you
# with 'as_matrixset'. But you can't control what it is.
as_matrixset(matrix(1:6, 2, 3))