Determine Which Values are Missing Values or IEEE Special Values

DESCRIPTION:

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

USAGE:

which.na(x) 
which.nan(x) 
which.inf(x)
which.infinite(x)

REQUIRED ARGUMENTS:

x
a S-PLUS object, which should be of mode "logical", "bdLogical", "numeric", "bdNumeric", or "complex".

VALUE:

integer vector or bdVector containing indices of elements in x which are missing or IEEE special values, according to which function is called. If there are no missing values or IEEE special values, the functions return an integer vector or bdVector of length 0 ( numeric(0)). which.na returns the indices of values in x which are missing or "Not a Number". which.nan returns the indices of values in x which are "Not a Number". which.inf returns the indices of values in x which are infinite (positive or negative).

SEE ALSO:

, , .

EXAMPLES:

# 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) 
which.inf(weird.values) 
# Produces:
# [1] 1 2 
which.nan(weird.values) 
# Produces:
#  [1] 3 
which.na(weird.values) 
# Produces:
#  [1] 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)]