This function calculates the number of values in a vector that are not NA.

notNA(x, big.mark = NULL, scientific = FALSE, ...)

Arguments

x

A vector.

big.mark

Argument to pass to format(), if a formatted string is desired.

scientific

Argument to pass to format() if big.mark is specified. Defaults to FALSE, unlike in format().

...

Other arguments to pass to format(). Ignored if big.mark is not specified.

Details

This function just shorthand for sum(!is.na(x)), with a shorter name for reference in the vtable or sumtable summ option.

If big.mark is specified, will return a formatted string instead of a number, where the formatting is based on format(x, big.mark = big.mark, scientific = FALSE, ...).

Examples

x <- c(1, 1, NA, 2, 3, NA)
notNA(x)
#> [1] 4
notNA(1:10000, big.mark = ',')
#> [1] "10,000"