length2: Length of a list with or without NA values

View source: R/length2.R

length2R Documentation

Length of a list with or without NA values

Description

Replacement for length(). Finds count of items like length(), but if set na.rm=TRUE then it doesn't count the items that are NA

Usage

length2(x, na.rm = FALSE)

Arguments

x

A vector, required.

na.rm

Logical value, optional, FALSE by default. Should NA values be left out of the count?

Value

Returns a single number.

Examples

length2(c(1,2,3,NA))
length2(c(1,2,3,NA), na.rm=TRUE)

ejanalysis/analyze.stuff documentation built on April 2, 2024, 10:10 a.m.