NaArray-misc-methods | R Documentation |
This man page documents various base array operations that are supported by NaArray derivatives, and that didn't belong to any of the groups of operations documented in the other man pages of the SparseArray package.
# --- unary isometric array transformations ---
## S4 method for signature 'NaArray'
is.nan(x)
## S4 method for signature 'NaArray'
is.infinite(x)
# --- N-ary isometric array transformations ---
# COMING SOON...
x |
An NaArray object. |
More operations will be added in the future.
is.nan()
and is.infinite()
return a SparseArray
object of type()
"logical"
and same dimensions as the
input object.
base::is.nan
and
base::is.infinite
in base R.
NaArray objects.
SparseArray objects.
Ordinary array objects in base R.
a <- array(c(NA, 2.77, NaN, Inf, NA, -Inf), dim=5:3)
naa <- NaArray(a) # NaArray object
naa
is.nan(naa) # SparseArray object of type "logical"
is.infinite(naa) # SparseArray object of type "logical"
## Sanity checks:
res <- is.nan(naa)
stopifnot(is(res, "SparseArray"), type(res) == "logical",
identical(as.array(res), is.nan(a)))
res <- is.infinite(naa)
stopifnot(is(res, "SparseArray"), type(res) == "logical",
identical(as.array(res), is.infinite(a)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.