DelayedMatrix row/col summarization
matrixStats-methods.RdOnly a small number of row/col summarization methods are provided by the DelayedArray package.
See the DelayedMatrixStats package for an extensive set of row/col summarization methods.
Usage
## N.B.: Showing ONLY the col*() methods (usage of row*() methods is
## the same):
# S4 method for class 'DelayedMatrix'
colSums(x, na.rm=FALSE, dims=1)
# S4 method for class 'DelayedMatrix'
colMeans(x, na.rm=FALSE, dims=1)
# S4 method for class 'DelayedMatrix'
colMins(x, rows=NULL, cols=NULL, na.rm=FALSE, useNames=TRUE)
# S4 method for class 'DelayedMatrix'
colMaxs(x, rows=NULL, cols=NULL, na.rm=FALSE, useNames=TRUE)
# S4 method for class 'DelayedMatrix'
colRanges(x, rows=NULL, cols=NULL, na.rm=FALSE, useNames=TRUE)
# S4 method for class 'DelayedMatrix'
colVars(x, rows=NULL, cols=NULL, na.rm=FALSE, center=NULL, useNames=TRUE)Arguments
- x
A DelayedMatrix object.
- na.rm, useNames, center
See man pages for the corresponding generics in the MatrixGenerics package (e.g.
?MatrixGenerics::rowVars) for a description of these arguments.- dims, rows, cols
These arguments are not supported. Don't use them.
See also
The DelayedMatrixStats package for more row/col summarization methods for DelayedMatrix objects.
The man pages for the various generic functions defined in the MatrixGenerics package e.g.
MatrixGenerics::colVarsetc...DelayedMatrix-rowsum for
rowsum()andcolsum()methods for DelayedMatrix objects.DelayedMatrix-mult for DelayedMatrix multiplication and cross-product.
DelayedArray objects.
Examples
library(HDF5Array)
toy_h5 <- system.file("extdata", "toy.h5", package="HDF5Array")
h5ls(toy_h5)
#> group name otype dclass dim
#> 0 / M1 H5I_DATASET FLOAT 10000 x 150
#> 1 / M2 H5I_DATASET FLOAT 150 x 200
M1 <- HDF5Array(toy_h5, "M1")
M2 <- HDF5Array(toy_h5, "M2")
M12 <- rbind(M1, t(M2)) # delayed
## All these operations are block-processed.
rsums <- rowSums(M12)
csums <- colSums(M12)
rmeans <- rowMeans(M12)
cmeans <- colMeans(M12)
rmins <- rowMins(M12)
cmins <- colMins(M12)
rmaxs <- rowMaxs(M12)
cmaxs <- colMaxs(M12)
rranges <- rowRanges(M12)
cranges <- colRanges(M12)
rvars <- rowVars(M12, center=rmeans)
cvars <- colVars(M12, center=cmeans)
## Sanity checks:
m12 <- rbind(as.matrix(M1), t(as.matrix(M2)))
stopifnot(
identical(rsums, rowSums(m12)),
identical(csums, colSums(m12)),
identical(rmeans, rowMeans(m12)),
identical(cmeans, colMeans(m12)),
identical(rmins, rowMins(m12)),
identical(cmins, colMins(m12)),
identical(rmaxs, rowMaxs(m12)),
identical(cmaxs, colMaxs(m12)),
identical(rranges, cbind(rmins, rmaxs, deparse.level=0)),
identical(cranges, cbind(cmins, cmaxs, deparse.level=0)),
all.equal(rvars, rowVars(m12)),
all.equal(cvars, colVars(m12))
)