add_N_to_catVar: Add sample size to the value

View source: R/add_N_to_catVar.R

add_N_to_catVarR Documentation

Add sample size to the value

Description

Add sample size to the value

Usage

add_N_to_catVar(x)

Arguments

x

A vector, of any type

Value

A factor with the label and how many times that label appeared in x

Examples


data(mtcars)

mtcars$cyl_n <- add_N_to_catVar(mtcars$cyl)

# you can also pipe it with tidyverse
mtcars %>%
mutate(cyl_n = add_N_to_catVar(cyl))


g-antonello/gautils2 documentation built on Nov. 28, 2022, 9:39 a.m.