colNA {quest} | R Documentation |
Frequency of Missing Values by Column
Description
rowNA
compute the frequency of missing values in a matrix by column.
This function essentially does apply(X = x, MARGIN = 2, FUN = vecNA)
.
It is also used by other functions in the quest package related to missing
values (e.g., colMeans_if
).
Usage
colNA(x, prop = FALSE, ov = FALSE)
Arguments
x |
matrix with any typeof. If not a matrix, it will be coerced to a
matrix via |
prop |
logical vector of length 1 specifying whether the frequency of missing values should be returned as a proportion (TRUE) or a count (FALSE). |
ov |
logical vector of length 1 specifying whether the frequency of observed values (TRUE) should be returned rather than the frequency of missing values (FALSE). |
Value
numeric vector of length = ncol(x)
, and names =
colnames(x)
providing the frequency of missing values (or observed
values if ov
= TRUE) per column. If prop
= TRUE, the values
will range from 0 to 1. If prop
= FALSE, the values will range from
1 to nrow(x)
.
See Also
Examples
colNA(as.matrix(airquality)) # count of missing values
colNA(as.matrix(airquality), prop = TRUE) # proportion of missing values
colNA(as.matrix(airquality), ov = TRUE) # count of observed values
colNA(as.data.frame(airquality), prop = TRUE, ov = TRUE) # proportion of observed values