NA.
data.frame,
bdFrame,
factor.
is.na(x)
x, with
TRUE wherever there is an
NA
in
x and
FALSE elsewhere.
Note that
is.na returns
TRUE for
NaN values,
which are generated by mathematically indeterminate expressions such as
Inf - Inf. To test whether a value is a
NaN, use the
is.nan.
This function will be used as the default method for classes that do not inherit a specific method for the function The result will retain the class and the attributes. If this behavior is not appropriate, the designer of the class should provide a method for the function.
This is always
FALSE when
x is of mode
"character".
# if function transform(y) cannot take NA's: y.ok <- !is.na(y) y[y.ok] <- transform(y[y.ok]) # Specific example, involving log: y <- c(1, NA, 4) y[!is.na(y)] <- log(y[!is.na(y)]) # Two ways to test whether an object has missing values: any(is.na(y)) (length(which.na(y)) > 0) # Using which.na() may save memory; is.na() creates a logical vector # the same length as y, which.na() creates a vector whose length is # only equal to the number of missing values