helseprofil / orgdata

:package: R package for aggregating original data mostly on enumeration areas level of granularity
https://helseprofil.github.io/orgdata/
Other
1 stars 0 forks source link

Categorise age to common interval #287

Closed ybkamaleri closed 2 years ago

ybkamaleri commented 2 years ago

Code can be implemented in kodebook or column Extra eg.

AgeCat(5) to categorise age to 5 years interval or AgeCat(1, 18, 50, 70) to categorise to specific interval

ybkamaleri commented 2 years ago

With AgeCat(5) can use cut() eg.

cut(age, breaks = c(seq(min(age), max(age), by = 5), Inf), right = FALSE) 

And use fcase() for specified categories.