rp <- rec_pattern(1, 100)
rp
# sample data, inspect age of carers
data(efc)
table(efc$c160age, exclude = NULL)
table(rec(efc$c160age, rp$pattern), exclude = NULL)
# recode carers age into groups of width 5
x <- rec(efc$c160age, rp$pattern)
# add value labels to new vector
set_labels(x) <- rp$labels
# watch result
frq(as_labelled(x))
Run the code above in your browser using DataLab