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/gautils documentation built on May 3, 2024, 10:51 a.m.