matrixStats: Functions that Apply to Rows and Columns of Matrices (and to Vectors)

High-performing functions operating on rows and columns of matrices, e.g. col / rowMedians(), col / rowRanks(), and col / rowSds(). Functions optimized per data type and for subsetted calculations such that both memory usage and processing time is minimized. There are also optimized vector-based methods, e.g. binMeans(), madDiff() and weightedMedian().

Install the latest version of this package by entering the following in R:
install.packages("matrixStats")
AuthorHenrik Bengtsson [aut, cre, cph], Hector Corrada Bravo [ctb], Robert Gentleman [ctb], Ola Hossjer [ctb], Harris Jaffee [ctb], Dongcan Jiang [ctb], Peter Langfelder [ctb]
Date of publication2017-04-14 14:49:54 UTC
MaintainerHenrik Bengtsson <henrikb@braju.com>
LicenseArtistic-2.0
Version0.52.2
https://github.com/HenrikBengtsson/matrixStats

View on CRAN

Man pages

allocMatrix: Allocates an empty vector, matrix or array

anyMissing: Checks if there are any missing values in an object or not

binCounts: Fast element counting in non-overlapping bins

binMeans: Fast mean calculations in non-overlapping bins

diff2: Fast lagged differences

indexByRow: Translates matrix indices by rows into indices by columns

logSumExp: Accurately computes the logarithm of the sum of exponentials

matrixStats-package: Package matrixStats

mean2: Fast averaging over subset of vector elements

rowAlls: Checks if a value exists / does not exist in each row...

rowAvgsPerColSet: Applies a row-by-row (column-by-column) averaging function to...

rowCollapse: Extracts one cell per row (column) from a matrix

rowCounts: Counts the number of TRUE values in each row (column) of a...

rowCumsums: Cumulative sums, products, minima and maxima for each row...

rowDiffs: Calculates difference for each row (column) in a matrix

rowIQRs: Estimates of the interquartile range for each row (column) in...

rowLogSumExps: Accurately computes the logarithm of the sum of exponentials...

rowMeans2: Calculates the mean for each row (column) in a matrix

rowMedians: Calculates the median for each row (column) in a matrix

rowOrderStats: Gets an order statistic for each row (column) in a matrix

rowProds: Calculates the product for each row (column) in a matrix

rowQuantiles: Estimates quantiles for each row (column) in a matrix

rowRanges: Gets the range of values in each row (column) of a matrix

rowRanks: Gets the rank of each row (column) of a matrix

rowSds: Standard deviation estimates for each row (column) in a...

rowSums2: Calculates the sum for each row (column) in a matrix

rowTabulates: Tabulates the values in a matrix by row (column)

rowVars: Variance estimates for each row (column) in a matrix

rowWeightedMeans: Calculates the weighted means for each row (column) in a...

rowWeightedMedians: Calculates the weighted medians for each row (column) in a...

signTabulate: Calculates the number of negative, zero, positive and missing...

sum2: Fast sum over subset of vector elements

validateIndices: Validate indices

varDiff: Estimation of scale based on sequential-order differences

weightedMad: Weighted Median Absolute Deviation (MAD)

weightedMean: Weighted Arithmetic Mean

weightedMedian: Weighted Median Value

weightedVar: Weighted variance and weighted standard deviation

x_OP_y: Fast calculation of 'z <- x OP y' and 'z <- t(t(x) OP y)'

Functions

allocArray Man page
allocMatrix Man page
allocVector Man page
allValue Man page
anyMissing Man page
anyValue Man page
binCounts Man page
binMeans Man page
colAlls Man page
colAnyMissings Man page
colAnyNAs Man page
colAnys Man page
colAvgsPerRowSet Man page
colCollapse Man page
colCounts Man page
colCummaxs Man page
colCummins Man page
colCumprods Man page
colCumsums Man page
colDiffs Man page
colIQRDiffs Man page
colIQRs Man page
colLogSumExps Man page
colMadDiffs Man page
colMads Man page
colMaxs Man page
colMeans2 Man page
colMedians Man page
colMins Man page
colOrderStats Man page
colProds Man page
colQuantiles Man page
colRanges Man page
colRanks Man page
colSdDiffs Man page
colSds Man page
colSums2 Man page
colTabulates Man page
colVarDiffs Man page
colVars Man page
colWeightedMads Man page
colWeightedMeans Man page
colWeightedMedians Man page
colWeightedSds Man page
colWeightedVars Man page
count Man page
diff2 Man page
indexByRow Man page
iqr Man page
iqrDiff Man page
logSumExp Man page
madDiff Man page
matrixStats Man page
matrixStats-package Man page
mean2 Man page
meanOver Man page
product Man page
rowAlls Man page
rowAnyMissings Man page
rowAnyNAs Man page
rowAnys Man page
rowAvgsPerColSet Man page
rowCollapse Man page
rowCounts Man page
rowCummaxs Man page
rowCummins Man page
rowCumprods Man page
rowCumsums Man page
rowDiffs Man page
rowIQRDiffs Man page
rowIQRs Man page
rowLogSumExps Man page
rowMadDiffs Man page
rowMads Man page
rowMaxs Man page
rowMeans2 Man page
rowMedians Man page
rowMins Man page
rowOrderStats Man page
rowProds Man page
rowQuantiles Man page
rowRanges Man page
rowRanks Man page
rowSdDiffs Man page
rowSds Man page
rowSums2 Man page
rowTabulates Man page
rowVarDiffs Man page
rowVars Man page
rowWeightedMads Man page
rowWeightedMeans Man page
rowWeightedMedians Man page
rowWeightedSds Man page
rowWeightedVars Man page
sdDiff Man page
signTabulate Man page
sum2 Man page
sumOver Man page
t_tx_OP_y Man page
validateIndices Man page
varDiff Man page
weightedMad Man page
weightedMean Man page
weightedMedian Man page
weightedSd Man page
weightedVar Man page
x_OP_y Man page

Files

inst
inst/benchmarking
inst/benchmarking/colRowAlls.md.rsp
inst/benchmarking/binMeans.md.rsp
inst/benchmarking/x_OP_y.md.rsp
inst/benchmarking/colRowAlls_subset.md.rsp
inst/benchmarking/colRowWeightedMeans_subset.md.rsp
inst/benchmarking/varDiff.md.rsp
inst/benchmarking/colRowMedians.md.rsp
inst/benchmarking/mean2_subset.md.rsp
inst/benchmarking/colRowCummins.md.rsp
inst/benchmarking/colRowCumsums.md.rsp
inst/benchmarking/colRowProds_subset.md.rsp
inst/benchmarking/colRowAnyMissings.md.rsp
inst/benchmarking/colRowMins.md.rsp
inst/benchmarking/colRowAnyMissings_subset.md.rsp
inst/benchmarking/includes
inst/benchmarking/includes/footer.md.rsp
inst/benchmarking/includes/header.md.rsp
inst/benchmarking/includes/results.md.rsp
inst/benchmarking/includes/setup.md.rsp
inst/benchmarking/includes/references.md.rsp
inst/benchmarking/includes/appendix.md.rsp
inst/benchmarking/colRowOrderStats.md.rsp
inst/benchmarking/product_subset.md.rsp
inst/benchmarking/colRowAnys_subset.md.rsp
inst/benchmarking/mean2.md.rsp
inst/benchmarking/colRowMeans2.md.rsp
inst/benchmarking/colRowCounts.md.rsp
inst/benchmarking/colRowMads.md.rsp
inst/benchmarking/index.md.rsp
inst/benchmarking/binMeans_subset.md.rsp
inst/benchmarking/colRowDiffs_subset.md.rsp
inst/benchmarking/colRowCounts_subset.md.rsp
inst/benchmarking/colRowWeightedMedians_subset.md.rsp
inst/benchmarking/product.md.rsp
inst/benchmarking/indexByRow.md.rsp
inst/benchmarking/R
inst/benchmarking/R/random-matrices.R inst/benchmarking/R/random-vectors.R
inst/benchmarking/colRowDiffs.md.rsp
inst/benchmarking/sum2_subset.md.rsp
inst/benchmarking/colRowMedians_subset.md.rsp
inst/benchmarking/anyMissing.md.rsp
inst/benchmarking/colRowCummins_subset.md.rsp
inst/benchmarking/colRowCumprods.md.rsp
inst/benchmarking/colRowTabulates.md.rsp
inst/benchmarking/colRowRanges.md.rsp
inst/benchmarking/colRowRanks_subset.md.rsp
inst/benchmarking/x_OP_y_subset.md.rsp
inst/benchmarking/allocVector.md.rsp
inst/benchmarking/colRowLogSumExps_subset.md.rsp
inst/benchmarking/colRowMeans2_subset.md.rsp
inst/benchmarking/weightedMean_subset.md.rsp
inst/benchmarking/t_tx_OP_y.md.rsp
inst/benchmarking/colRowMins_subset.md.rsp
inst/benchmarking/madDiff.md.rsp
inst/benchmarking/colRowTabulates_subset.md.rsp
inst/benchmarking/colRowQuantiles_subset.md.rsp
inst/benchmarking/colRowQuantiles.md.rsp
inst/benchmarking/weightedMean.md.rsp
inst/benchmarking/colRowWeightedMeans.md.rsp
inst/benchmarking/colRowVars_subset.md.rsp
inst/benchmarking/count.md.rsp
inst/benchmarking/colRowCumprods_subset.md.rsp
inst/benchmarking/weightedMedian.md.rsp
inst/benchmarking/anyMissing_subset.md.rsp
inst/benchmarking/binCounts.md.rsp
inst/benchmarking/sum2.md.rsp
inst/benchmarking/colRowLogSumExps.md.rsp
inst/benchmarking/logSumExp.md.rsp
inst/benchmarking/colRowRanks.md.rsp
inst/benchmarking/colRowSums2.md.rsp
inst/benchmarking/count_subset.md.rsp
inst/benchmarking/binCounts_subset.md.rsp
inst/benchmarking/colRowWeightedMedians.md.rsp
inst/benchmarking/madDiff_subset.md.rsp
inst/benchmarking/weightedMedian_subset.md.rsp
inst/benchmarking/colRowVars.md.rsp
inst/benchmarking/colRowSums2_subset.md.rsp
inst/benchmarking/colRowAnys.md.rsp
inst/benchmarking/varDiff_subset.md.rsp
inst/benchmarking/allocMatrix.md.rsp
inst/benchmarking/colRowOrderStats_subset.md.rsp
inst/benchmarking/t_tx_OP_y_subset.md.rsp
inst/benchmarking/colRowProds.md.rsp
inst/benchmarking/colRowRanges_subset.md.rsp
inst/benchmarking/colRowMads_subset.md.rsp
inst/benchmarking/logSumExp_subset.md.rsp
inst/benchmarking/colRowCumsums_subset.md.rsp
inst/doc
inst/doc/matrixStats-methods.md.rsp
inst/doc/matrixStats-methods.html
tests
tests/rowOrderStats_subset.R tests/x_OP_y_subset.R tests/rowWeightedVars_subset.R tests/signTabulate.R tests/rowMeans2.R tests/diff2.R tests/rowCumMinMaxs_subset.R tests/rowRanks.R tests/rowCollapse.R tests/count_subset.R tests/weightedMean.R tests/rowProds.R tests/x_OP_y.R tests/rowWeightedMeans_subset.R tests/rowCollapse_subset.R tests/validateIndices.R tests/rowAvgsPerColSet_subset.R tests/sum2_subset.R tests/rowSds_subset.R tests/rowDiffs_subset.R tests/rowRanges.R tests/allocArray.R tests/count.R tests/rowWeightedMeans.R tests/sum2.R tests/rowMeans2_subset.R tests/rowCounts_subset.R tests/rowCumMinMaxs.R tests/rowMedians_subset.R tests/indexByRow.R tests/mean2_subset.R tests/binCounts.R tests/varDiff_etal.R tests/rowOrderStats.R tests/rowMads_subset.R tests/rowVarDiffs.R tests/rowCumsums.R tests/binMeans,binCounts_subset.R tests/benchmark.R tests/rowVarDiffs_var,sd_subset.R tests/rowRanks_subset.R tests/rowVars_subset.R tests/zzz.package-unload.R tests/rowSums2_subset.R tests/rowAvgsPerColSet.R tests/rowCumprods_subset.R tests/rowRanges_subset.R tests/rowWeightedVars.R tests/rowIQRs_subset.R tests/rowCumsums_subset.R tests/rowTabulates_subset.R tests/allocMatrix.R tests/signTabulate_subset.R tests/anyMissing_subset.R tests/rowLogSumExps_subset.R tests/rowWeightedMedians.R tests/rowMedians.R tests/rowLogSumExps.R tests/rowVars.R tests/product.R tests/binMeans,binCounts.R tests/allocVector.R tests/weightedMedian.R tests/rowMads.R tests/rowQuantiles_subset.R tests/rowCumprods.R tests/rowAllAnys_subset.R tests/rowTabulates.R tests/diff2_subset.R tests/weightedMean_subset.R tests/rowCounts.R tests/psortKM.R tests/binCounts_subset.R tests/rowProds_subset.R tests/rowDiffs.R tests/rowVarDiffs_mad,iqr_subset.R tests/logSumExp.R tests/logSumExp_subset.R tests/rowSums2.R tests/rowWeightedMedians_subset.R tests/weightedMedian_subset.R tests/weightedVar.R tests/varDiff_etal_subset.R tests/product_subset.R tests/weightedVar_etal_subset.R tests/mean2.R tests/rowSds.R tests/anyMissing.R tests/weightedVar_etal.R
tests/utils
tests/utils/validateIndicesFramework.R tests/rowIQRs.R tests/rowAllAnys.R tests/rowQuantiles.R
src
src/productExpSumLog_lowlevel_template.h
src/productExpSumLog.c
src/weightedMean.c
src/productExpSumLog_lowlevel.h
src/x_OP_y.c
src/rowCumprods_lowlevel_template.h
src/rowOrderStats.c
src/weightedMedian_lowlevel.h
src/binMeans.c
src/mean2.c
src/rowCummaxs.c
src/rowCumMinMaxs_lowlevel_template.h
src/rowMads_lowlevel_template.h
src/signTabulate_lowlevel.h
src/binCounts_lowlevel.h
src/allocMatrix2.c
src/rowDiffs.c
src/colOrderStats_lowlevel.h
src/rowVars.c
src/sum2.c
src/rowSums2_lowlevel_template.h
src/psortKM.c
src/000.templates-types_undef.h
src/validateIndices.c
src/000.utils.h
src/rowRanksWithTies_lowlevel_template.h
src/rowSums2_lowlevel.h
src/rowMedians.c
src/rowLogSumExp.c
src/colCounts.c
src/rowMeans2_lowlevel.h
src/colCounts_lowlevel.h
src/validateIndices_lowlevel.h
src/rowCummins_lowlevel.h
src/rowCumprods_lowlevel.h
src/indexByRow.c
src/rowCumsums_lowlevel.h
src/diff2_lowlevel_template.h
src/binMeans_lowlevel_template.h
src/000.api.h
src/rowCounts.c
src/mean2_lowlevel_template.h
src/binMeans_lowlevel.h
src/weightedMean_lowlevel_template.h
src/rowLogSumExp_lowlevel.h
src/rowCummins.c
src/rowOrderStats_lowlevel.h
src/rowOrderStats_lowlevel_template.h
src/anyMissing_lowlevel_template.h
src/x_OP_y_lowlevel_template.h
src/000.types.h
src/rowMedians_lowlevel.h
src/rowDiffs_lowlevel.h
src/anyMissing.c
src/diff2_lowlevel.h
src/anyMissing_lowlevel.h
src/colOrderStats.c
src/sum2_lowlevel_template.h
src/colRanges.c
src/weightedMean_lowlevel.h
src/rowRanksWithTies_lowlevel.h
src/000.macros.h
src/rowMedians_lowlevel_template.h
src/000.init.c
src/signTabulate.c
src/binCounts.c
src/rowCumprods.c
src/weightedMedian_lowlevel_template.h
src/rowRanges_lowlevel_template.h
src/diff2.c
src/colCounts_lowlevel_template.h
src/mean2_lowlevel.h
src/rowCounts_lowlevel_template.h
src/rowRanksWithTies.c
src/logSumExp_lowlevel_template.h
src/rowRanges.c
src/logSumExp_lowlevel.h
src/rowCumsums_lowlevel_template.h
src/rowVars_lowlevel_template.h
src/rowCumsums.c
src/000.templates-types.h
src/logSumExp.c
src/signTabulate_lowlevel_template.h
src/rowMeans2_lowlevel_template.h
src/rowMads_lowlevel.h
src/rowMeans2.c
src/weightedMedian.c
src/colRanges_lowlevel.h
src/rowVars_lowlevel.h
src/rowDiffs_lowlevel_template.h
src/rowCummaxs_lowlevel.h
src/x_OP_y_lowlevel.h
src/rowSums2.c
src/rowLogSumExp_lowlevel_template.h
src/binCounts_lowlevel_template.h
src/rowMads.c
src/validateIndices_lowlevel_template.h
src/000.templates-gen-vector.h
src/rowCounts_lowlevel.h
src/sum2_lowlevel.h
src/000.templates-gen-matrix-vector.h
src/colOrderStats_lowlevel_template.h
src/000.templates-gen-matrix.h
src/colRanges_lowlevel_template.h
src/rowRanges_lowlevel.h
NAMESPACE
NEWS
R
R/signTabulate.R R/rowMeans2.R R/diff2.R R/rowRanks.R R/rowCollapse.R R/weightedMean.R R/rowProds.R R/x_OP_y.R R/validateIndices.R R/rowRanges.R R/rowAlls.R R/rowWeightedMeans.R R/sum2.R R/indexByRow.R R/binCounts.R R/rowOrderStats.R R/rowCumsums.R R/benchmark.R R/rowAvgsPerColSet.R R/allocMatrix.R R/rowWeightedMedians.R R/rowMedians.R R/rowLogSumExps.R R/rowVars.R R/product.R R/weightedMedian.R R/rowMads.R R/varDiff.R R/rowTabulates.R R/weightedMad.R R/rowCounts.R R/psortKM.R R/rowDiffs.R R/logSumExp.R R/binMeans.R R/rowSums2.R R/999.package.R R/weightedVar.R R/mean2.R R/rowSds.R R/zzz.R R/anyMissing.R R/rowIQRs.R R/rowQuantiles.R
vignettes
vignettes/matrixStats-methods.md.rsp
MD5
build
build/vignette.rds
DESCRIPTION
man
man/rowOrderStats.Rd man/rowWeightedMedians.Rd man/rowSums2.Rd man/weightedMedian.Rd man/rowCollapse.Rd man/binCounts.Rd man/rowProds.Rd man/binMeans.Rd man/anyMissing.Rd man/logSumExp.Rd man/varDiff.Rd man/weightedVar.Rd man/rowDiffs.Rd man/diff2.Rd man/validateIndices.Rd man/rowMedians.Rd man/weightedMean.Rd man/rowQuantiles.Rd man/allocMatrix.Rd man/rowTabulates.Rd man/rowVars.Rd man/rowWeightedMeans.Rd man/signTabulate.Rd man/rowMeans2.Rd man/mean2.Rd man/x_OP_y.Rd man/rowSds.Rd man/rowAvgsPerColSet.Rd man/rowCumsums.Rd man/rowRanges.Rd man/indexByRow.Rd man/rowCounts.Rd man/matrixStats-package.Rd man/sum2.Rd man/weightedMad.Rd man/rowAlls.Rd man/rowRanks.Rd man/rowIQRs.Rd man/rowLogSumExps.Rd

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.