NaArray-Math-methods | R Documentation |
EXPERIMENTAL!!!
NaArray objects support all operations from the Math
and Math2
groups with a few exceptions.
See ?S4groupGeneric
in the methods package
for more information about the Math
and Math2
group generics.
Note that Math
and Math2
operations only support
NaArray objects of type()
"double"
at the moment.
NaArray objects of type()
"integer"
are not
supported yet.
A NaArray derivative of the same dimensions as the input object.
S4groupGeneric
in the methods package.
NaArray objects.
Ordinary array objects in base R.
nam <- NaArray(dim=c(15, 6))
nam[c(2, 6, 12:17, 22:33, 55, 59:62, 90)] <-
c(runif(22)*1e4, Inf, -Inf, NA, NaN)
log(nam)
exp(nam)
cos(nam)
lgamma(nam)
## Sanity checks:
m <- as.matrix(nam)
stopifnot(
suppressWarnings(identical(as.matrix(log(nam)), log(m))),
identical(as.matrix(exp(nam)), exp(m)),
suppressWarnings(identical(as.matrix(cos(nam)), cos(m))),
suppressWarnings(identical(as.matrix(lgamma(nam)), lgamma(m)))
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.