View source: R/quest_functions.R
vecNA | R Documentation |
vecNA
computes the frequency of missing values in an atomic vector.
vecNA
is essentially a wrapper for sum
or mean
+
is.na
or !is.na
and can be useful for functional programming
(e.g., lapply(FUN = vecNA)
). It is also used by other functions in the
quest package related to missing values (e.g., mean_if
).
vecNA(x, prop = FALSE, ov = FALSE)
x |
atomic vector or list vector. If not a vector, it will be coerced to
a vector 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). |
numeric vector of length 1 providing the frequency of missing values
(or observed values if ov
= TRUE). If prop
= TRUE, the value
will range from 0 to 1. If prop
= FALSE, the value will range from 1
to length(x)
.
is.na
rowNA
colNA
rowsNA
vecNA(airquality[[1]]) # count of missing values
vecNA(airquality[[1]], prop = TRUE) # proportion of missing values
vecNA(airquality[[1]], ov = TRUE) # count of observed values
vecNA(airquality[[1]], prop = TRUE, ov = TRUE) # proportion of observed values
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.