count_obs: Counting Observations in a Category

View source: R/utils.R

count_obsR Documentation

Counting Observations in a Category

Description

Count the number of observations in the smallest/largest category within a categorical variable, or the smallest/largest category defined by multiple categorical variables.

Usage

count_obs(data, cat_vars, fxn = c(min, max))

Arguments

data

dataset that contains the variables

cat_vars

names of categorical variables in a character vector

fxn

the min or max function

Value

number of observation

Examples

count_obs(ggplot2::diamonds, c("cut"), min)
count_obs(ggplot2::diamonds, c("cut", "color"), max)

sarazong/SZRtools documentation built on Feb. 8, 2024, 6:49 a.m.