Creates age grouping variable for a given data set

age_groups(df, break_at = NULL)

Arguments

df

data frame on which the age grouping is created

break_at

integer that controls the length of the age groups

Examples

if (FALSE) {
input_path <- "data/input/input_sample.csv"
data <- read.csv(input_path, header = TRUE, sep = ",")
data$age <- sample(1:125, 10, replace = TRUE)
age_groups(data) # default age groups
age_groups(data, c(15L, 35L, 65L, 100L)) # custom age groups
}