Apply Functions Over Matrix Margins (Rows or Columns)
## S3 method for class 'bigz' apply(X, MARGIN, FUN, ...) ## S3 method for class 'bigq' apply(X, MARGIN, FUN, ...)
X |
a matrix of class bigz or bigq, see e.g.,
|
MARGIN |
1: apply function to rows; 2: apply function to columns |
FUN |
|
... |
(optional) extra arguments for |
The bigz
and bigq
methods return a vector of class
"bigz"
or "bigq"
, respectively.
Antoine Lucas
x <- as.bigz(matrix(1:12,3)) apply(x,1,min) apply(x,2,max) x <- as.bigq(x ^ 3, d = (x + 3)^2) apply(x,1, min) apply(x,2, sum) ## now use the "..." to pass na.rm=TRUE : x[2,3] <- NA apply(x,1, sum) apply(x,1, sum, na.rm = TRUE)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.