nNA: Count the number of NAs in a vector

Description Usage Arguments Details Value Examples

Description

Shortcut for compose(sum, is.na, unlist)

Usage

1
nNA(x)

Arguments

x

a vector whose elements are to be tested.

Details

As any number different from 0 return a TRUE when coerced to logical, this function can be used in if statements.

Value

Return the number of NA in x.

Examples

1
2
3
4
x <- c(rep(NA, 3), 1:3)
nNA(x)
if (nNA(x)) {TRUE} else {FALSE}
if (nNA(1:3)) {TRUE} else {FALSE}

SESman/rbl documentation built on May 9, 2019, 11:10 a.m.