File: NaArray-misc-methods.Rd

package info (click to toggle)
r-bioc-sparsearray 1.6.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,768 kB
  • sloc: ansic: 16,138; makefile: 2
file content (79 lines) | stat: -rw-r--r-- 1,825 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
\name{NaArray-misc-methods}

\alias{NaArray-misc-methods}
\alias{NaArray_misc_methods}
\alias{NaArray-misc}
\alias{NaArray_misc}

\alias{is.na,NaArray-method}
\alias{is.nan,NaArray-method}
\alias{is.infinite,NaArray-method}

\title{Miscellaneous operations on a NaArray object}

\description{
  This man page documents various base array operations that are
  supported by \link{NaArray} derivatives, and that didn't belong
  to any of the groups of operations documented in the other man pages
  of the \pkg{SparseArray} package.
}

\usage{
# --- unary isometric array transformations ---

\S4method{is.nan}{NaArray}(x)

\S4method{is.infinite}{NaArray}(x)

# --- N-ary isometric array transformations ---

# COMING SOON...
}

\arguments{
  \item{x}{
    An \link{NaArray} object.
  }
}

\details{
  More operations will be added in the future.
}

\value{
  \code{is.nan()} and \code{is.infinite()} return a \link{SparseArray}
  object of \code{type()} \code{"logical"} and same dimensions as the
  input object.
}

\seealso{
  \itemize{
    \item \code{base::\link[base]{is.nan}} and
          \code{base::\link[base]{is.infinite}} in base R.

    \item \link{NaArray} objects.

    \item \link{SparseArray} objects.

    \item Ordinary \link[base]{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)))
}
\keyword{array}
\keyword{methods}