GetMatrix {grandR} | R Documentation |
Obtain a genes x values table as a large matrix
Description
This is the main function to access slot data for all genes as a (potentially sparse) matrix.
Usage
GetMatrix(
data,
mode.slot = DefaultSlot(data),
columns = NULL,
genes = Genes(data),
name.by = "Symbol",
summarize = NULL
)
Arguments
data |
A grandR object |
mode.slot |
Which kind of data to access (see details) |
columns |
which columns (i.e. samples or cells) to return (see details) |
genes |
Restrict the output table to the given genes |
name.by |
A column name of Coldata(data). This is used as the rownames of the output table |
summarize |
Should replicates by summarized? see details |
Details
To refer to data slots, the mode.slot syntax can be used: It is either a data slot, or one of (new,old,total) followed by a dot followed by a slot. For new or old, the data slot value is multiplied by ntr or 1-ntr. This can be used e.g. to obtain the new counts.
Columns can be given as a logical, integer or character vector representing a selection of the columns (samples or cells).
The expression is evaluated in an environment havin the Coldata
, i.e. you can use names of Coldata
as variables to
conveniently build a logical vector (e.g., columns=Condition=="x").
The summarization parameter can only be specified if columns is NULL. It is either a summarization matrix (GetSummarizeMatrix) or TRUE (in which case GetSummarizeMatrix(data) is called). If there a NA values, they are imputed as the mean per group!
Value
A (potentially) sparse matrix containing the desired values
See Also
GetData,GetAnalysisTable,DefaultSlot,Genes,GetSummarizeMatrix