how_many: How Many Unique Observations

Description Usage Arguments Value Examples

View source: R/func_how-many.R

Description

This generic function calculates how many unique observations are in a vector It is identical to length(unique(x)). However, this function can be used on either a vector or a data frame with a specified column. See the examples for more details.

Usage

1

Arguments

x

Object such as a data.frame or vector

...

Additional arguments passed to or from other methods.

Value

An integer indicating how many unique observations are in the object.

Examples

1
2
3
how_many(mtcars$cyl) # Pass in vector directly
how_many(mtcars, "cyl") # Subset dataframe with a character string for column name
how_many(mtcars, cyl) # Subset dataframe without needing to quote the column name

jdtrat/jdtools documentation built on Dec. 20, 2021, 10:05 p.m.