n_missing: Returns the number of missings in a variable or dataset. If...

Description Usage Arguments Examples

View source: R/shorthands.R

Description

Returns the number of missings in a variable or dataset. If missings are an explicit level in a factor variable, this function defaults to reporting them anyway.

Usage

1
n_missing(x, exclude = NA)

Arguments

x

variable

exclude

only needed for factors. defaults to NA (count level=missing as missing), setting to 0 allows you to count level=missing as nonmissing

Examples

1
2
3
4
5
6
7
data(beavers)
beaver1$activ[1:10] = NA
n_missing(beaver1$activ)
beaver1$activ = factor(beaver1$activ, exclude = NULL)
sum(is.na(beaver1$activ))
n_missing(beaver1$activ)
n_missing(beaver1$activ, exclude = NULL)

grebbel/formr_test documentation built on May 17, 2019, 8:34 a.m.