count_na: Count NA values in a vector

View source: R/count_na.R

count_naR Documentation

Count NA values in a vector

Description

Count NA values in a vector

Usage

count_na(x, mean = FALSE)

Arguments

x

a vector with data

mean

a boolean, if TRUE instead of the sum the mean of NAs is calculated.

Value

returns either the sum or the mean of NA values.

Author(s)

Jakob Gepp

Examples

x <- c(NA, NA, 1, NaN, 0)
count_na(x)
# [1] 3

x <- c(NA, NA, 1, NaN, "0")
count_na(x)
# [1] 2

STATWORX/helfRlein documentation built on Feb. 12, 2024, 2:21 a.m.