Learn R Programming

FAwR (version 1.1.2)

show.cols.with.na: Identifies variables in a dataframe that have missing values, along with a count.

Description

This function reports the number of missing values in each variable in a dataframe. Variables that have no missing values are ignored.

Usage

show.cols.with.na(x)

Arguments

x

The dataframe to check.

Value

A vector of missing values counts, one value for each variable with missing values. If no variables have missing values then prints a message and exits.

References

Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.

See Also

is.na

Examples

Run this code
# NOT RUN {
test <- data.frame(a = c(1,2), b = c(3,4))
show.cols.with.na(test)
is.na(test$a[2]) <- TRUE
show.cols.with.na(test)

# }

Run the code above in your browser using DataLab