notNA: Number of nonmissing values in a vector

View source: R/helpers.R

notNAR Documentation

Number of nonmissing values in a vector

Description

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

Usage

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)
notNA(1:10000, big.mark = ',')

vtable documentation built on Oct. 26, 2023, 5:08 p.m.