Description Usage Arguments Value Author(s)
View source: R/compressMatrix.R
compressMatrix() resizes a matrix by averaging groups of adjacent rows/columns (typically averaging or summing).
1 | compressMatrix(X, howmuch = 4, FUN = mean, na.rm = T, ...)
|
X |
A matrix or object that can be coerced to such (array, data.frame), typically numeric, though other types are possible depending on the FUN argument. |
howmuch |
One or two element integer vector specifying compression factor in each dimension. If length(howmuch)==1, both dimensions will be reduced by the same factor. |
FUN |
Function to apply for combining values. |
na.rm |
Logical; if TRUE, remove missing values from X prior to calling FUN |
... |
Additional arguments passed to FUN |
Returns a matrix with dimensions dim(X) / howmuch, where each element is average of howmuch[1] neighboring rows and howmuch[2] neighboring columns. If the original dimensions of X are not evenly divisible by howmuch, additional rows and/or columns of missing values will be appended.
M.W.Rowe, mwr.stats@gmail.com
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.