GetSummarizeMatrix {grandR} | R Documentation |
Create a summarize matrix
Description
If this matrix is multiplied with a count table (e.g. obtained by GetTable
),
either the average (average=TRUE) or the sum (average=FALSE) of all columns (samples or cells)
belonging to the same Condition
is computed.
Usage
GetSummarizeMatrix(x, ...)
## S3 method for class 'grandR'
GetSummarizeMatrix(x, no4sU = FALSE, columns = NULL, average = TRUE, ...)
## Default S3 method:
GetSummarizeMatrix(x, subset = NULL, average = TRUE, ...)
Arguments
x |
A grandR object or a named vector (the names indicate the sample names, the value the conditions to be summarized) |
... |
further arguments to be passed to or from other methods. |
no4sU |
Use no4sU columns (TRUE) or not (FALSE) |
columns |
which columns (i.e. samples or cells) to return (see details) |
average |
matrix to compute the average (TRUE) or the sum (FALSE) |
subset |
logical vector of which elements of the vector v to use (or NULL: use all) |
Details
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 having the Coldata
, i.e. you can use names of Coldata
as variables to
conveniently build a logical vector (e.g., columns=Condition="x").
The method for grandR object simply calls the general method
Value
A matrix to be multiplied with a count table
See Also
Examples
sars <- ReadGRAND(system.file("extdata", "sars.tsv.gz", package = "grandR"),
design=c("Condition",Design$dur.4sU,Design$Replicate))
GetSummarizeMatrix(sars)
head(as.matrix(GetTable(sars)) %*% GetSummarizeMatrix(sars)) # average by matrix multiplication
head(GetTable(sars,summarize = TRUE)) # shortcut, does the same
# See the data-matrices-and-analysis-results vignette for more examples!