which.na: Determine Which Values are Missing Values

Description Usage Arguments Value See Also Examples

Description

Returns an integer vector describing which values in the input vector, if any, are missing.

Usage

1

Arguments

x

an R object, which should be of mode "logical", "numeric", or "complex".

Value

an integer vector describing which values in the input vector, if any, are missing.

See Also

is.na.

Examples

1
2
3
4
5
6
7
8
9
## A non-zero number divided by zero creates 
## infinity, zero over zero creates a NaN 
weird.values <- c(1/0, -20.9/0, 0/0, NA)

## Produces: 3 4. In this example, the which.na 
## expression and the subscript expression 
## involving is.na should return the same value 
which.na(weird.values)
seq(along=weird.values)[is.na(weird.values)]

Example output

[1] 3 4
[1] 3 4

splus2R documentation built on Jan. 30, 2021, 9:05 a.m.