NaArray-misc-methods: Miscellaneous operations on a NaArray object

NaArray-misc-methodsR Documentation

Miscellaneous operations on a NaArray object

Description

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.

Usage

# --- 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...

Arguments

x

An NaArray object.

Details

More operations will be added in the future.

Value

is.nan() and is.infinite() return a SparseArray object of type() "logical" and same dimensions as the input object.

See Also

  • base::is.nan and base::is.infinite in base R.

  • NaArray objects.

  • SparseArray objects.

  • Ordinary array objects in base R.

Examples

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)))

Bioconductor/SparseArray documentation built on Oct. 20, 2024, 7:03 a.m.