naflex {naflex} | R Documentation |
naflex: Flexible Options for Handling Missing Values
Description
The naflex
package provides additional flexibility for handling
missing values in summary functions beyond the two extreme options
(na.rm = TRUE/FALSE
) available in base R.
Details
Most summary functions in R e.g. mean
provide the option for the two
extremes:
calculate the summary ignoring all missing values,
na.rm = TRUE
, orrequire no missing values for the summary to be calculated,
na.rm = FALSE
In many applications something in between these two extremes is often appropriate. For example, you may wish to give a summary statistic if less than 5% of values are missing.
naflex
provides helper functions to facilitate this flexibility for
dealing with missing values, particularly within summary functions.
In particular naflex
provides four types of missing value checks:
a maximum proportion of missing values allowed
a maximum number of missing values allowed
a maximum number of consecutive missing values allowed, and
a minimum number of non-missing values required.
These checks can be used individually or in combination with each other within summary functions.