count_NA {missMethods} | R Documentation |
Count the number of NA
s
Description
Count the number of NA
values in a vector, matrix or data frame
Usage
count_NA(x, type = "default")
Arguments
x |
a vector, matrix or data frame, in which NA values are counted
|
type |
How to count the NA values. Possible choices:
"default": If x is a matrix or a data frame, the number of missing
values per column is returned. If x is something else, the total number
of missing values in x is returned.
"all": The number of all missing values in x is returned.
"cols": The number of missing values per column is returned.
"rows": The number of missing values per row is returned.
|
Value
The number of missing values.
Examples
count_NA(c(1, NA, 3, NA, 5, NA))
test_df <- data.frame(X1 = rep(c(1, NA), 5), X2 = c(1:9, NA))
count_NA(test_df)
count_NA(test_df, "cols") # the default
count_NA(test_df, "rows")
count_NA(test_df, "all")
[Package
missMethods version 0.4.0
Index]