apply | R Documentation |
These are S3 methods
for apply()
which we
re-export as S3 generic function.
They “overload” the apply()
function for big rationals ("bigq"
)
and big integers ("bigz"
).
## 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
apply
; lapply
is used by our
apply()
method.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.