na_prop {naflex} | R Documentation |
Calculate missing value properties
Description
A set of functions for calculating missing values properties of a vector.
-
na_prop
: The proportion of missing values -
na_n
: The number of missing values -
na_consec
: The maximum number of consecutive missing values -
na_non_na
: The number of non-missing values
Usage
na_prop(x)
na_n(x)
na_consec(x)
na_non_na(x)
Arguments
x |
A vector to calculate the missing values property of. |
Details
These functions are used by na_omit_if
to omit missing values
conditionally on the value of these properties. They are also useful
summaries in their own right.
Value
Each function returns a number: a proportion (0 to 1) or a count.
Examples
na_prop(c(1, 2, NA, 4))
na_prop(c(1:9, NA))
na_n(c(1, 2, NA, 4, NA, NA, 7))
na_n(c(1:9, NA, NA))
na_consec(c(1, NA, NA, NA, 2, NA, NA, 7))
na_consec(c(rep(NA, 5), 1:2, rep(NA, 6)))
na_non_na(c(1, 2, NA, 4, NA, NA, 7))
na_non_na(c(1:9, NA, NA))
[Package naflex version 0.1.0 Index]