rp <- rec_pattern(1, 100)
rp
# sample data
data(efc)
# 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. due to recode-pattern, we have age groups with
# no observations (zero-counts)
frq(as_labelled(x))
# now, let's drop zero's
frq(as_labelled(drop_labels(x)))
Run the code above in your browser using DataLab