recode_agecat: Create age category based on year (of sale) and birth year

Description Usage Arguments See Also Examples

View source: R/category-variables.R

Description

Uses 'birth_year' (from cust) and 'year' (from sale) to identify age for each license year

Usage

1
2
3
recode_agecat(dat, age_labs = c("0-17", "18-24", "25-34", "35-44",
  "45-54", "55-64", "65+"), age_breaks = c(-Inf, 17, 24, 34, 44, 54, 64,
  Inf), max_age = 110, suppress_check = TRUE)

Arguments

dat

data frame: Input table

age_labs

character: labels to use for age category

age_breaks

numeric: breaks for age category passed to cut

max_age

numeric: maximum allowed age. Anything above will be set to missing.

suppress_check

logical: If TRUE, does not print a coding summary

See Also

Salic Function Reference: salic

Other functions for working with category variables: df_factor_var, factor_var, label_categories

Examples

1
2
3
library(dplyr)
data(history)
x <- recode_agecat(history, suppress_check = FALSE)

southwick-associates/salic documentation built on Nov. 5, 2019, 9:13 a.m.