Description Usage Arguments See Also Examples
Methods for function is.na()
, is.finite()
,
and is.infinite()
for all Matrices (objects
extending the Matrix
class):
returns a "nMatrix"
object of same
dimension as x
, with TRUE's whenever x
is
NA
, finite, or infinite, respectively.
ditto.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## S4 method for signature 'sparseMatrix'
is.na(x)
## S4 method for signature 'dsparseMatrix'
is.finite(x)
## S4 method for signature 'ddenseMatrix'
is.infinite(x)
## ...
## and for other classes
## S4 method for signature 'xMatrix'
anyNA(x)
## S4 method for signature 'nsparseMatrix'
anyNA(x)
## S4 method for signature 'sparseVector'
anyNA(x)
## S4 method for signature 'nsparseVector'
anyNA(x)
|
x |
sparse or dense matrix or sparse vector (here; any R object in general). |
NA
, is.na
;
is.finite
, is.infinite
;
nMatrix
,
denseMatrix
, sparseMatrix
.
The sparseVector
class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | M <- Matrix(1:6, nrow=4, ncol=3,
dimnames = list(c("a", "b", "c", "d"), c("A", "B", "C")))
stopifnot(all(!is.na(M)))
M[2:3,2] <- NA
is.na(M)
if(exists("anyNA", mode="function"))
anyNA(M)
A <- spMatrix(10,20, i = c(1,3:8),
j = c(2,9,6:10),
x = 7 * (1:7))
stopifnot(all(!is.na(A)))
A[2,3] <- A[1,2] <- A[5, 5:9] <- NA
inA <- is.na(A)
stopifnot(sum(inA) == 1+1+5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.