rowsum | R Documentation |
rowsum()
computes column sums across rows of a numeric matrix-like
object for each level of a grouping variable.
colsum()
computes row sums across columns of a numeric matrix-like
object for each level of a grouping variable.
NOTE: This man page is for the rowsum
and colsum
S4 generic functions defined in the S4Arrays package.
See ?base::rowsum
for the default rowsum()
method (defined in the base package).
Bioconductor packages can define specific methods for objects
(typically matrix-like) not supported by the default methods.
rowsum(x, group, reorder=TRUE, ...)
colsum(x, group, reorder=TRUE, ...)
x |
A numeric matrix-like object. |
group , reorder , ... |
See |
See ?base::rowsum
for the value returned
by the default method.
The default colsum()
method simply does
t(rowsum(t(x), group, reorder=reorder, ...))
.
Specific methods defined in Bioconductor packages should behave as consistently as possible with the default methods.
base::rowsum
for the default
rowsum
method.
showMethods
for displaying a summary of the
methods defined for a given generic function.
selectMethod
for getting the definition of
a specific method.
rowsum,DelayedMatrix-method in the
DelayedArray package for an example of a specific
rowsum
method (defined for DelayedMatrix
objects).
rowsum # note the dispatch on the 'x' arg only
showMethods("rowsum")
selectMethod("rowsum", "ANY") # the default rowsum() method
colsum # note the dispatch on the 'x' arg only
showMethods("colsum")
selectMethod("colsum", "ANY") # the default colsum() method
selectMethod("colsum", "matrix") # colsum() method for ordinary matrices
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.