CDU-data-science-team / nottshcMethods

An internal R package formalising common transformations, visualisations, and analyses of clinical data
https://cdu-data-science-team.github.io/nottshcMethods/
Other
4 stars 3 forks source link

Add as age groups #16

Closed milanwiedemann closed 3 years ago

milanwiedemann commented 3 years ago

add basic functionality for age groups (need to check that this all works on sql! @Lextuga007 can you plz give me some more info on these other grouping methods

milanwiedemann commented 3 years ago

@Lextuga007 I'm merging it as needed now, but would be good to add further functionality as discussed at some point later

Lextuga007 commented 3 years ago

The set age bands are https://cdu-data-science-team.github.io/team-blog/posts/2021-06-22-age-bands-methodology/ but it might be best, as this issue suggests, having a function to determine the age bands as required. The data warehouse has a SQL table function which takes the parameters DateOfBirth, OnDate, Range, Limit.

We've used the package epitools before to get the age on a given date as this function takes into account leap years https://www.rdocumentation.org/packages/eeptools/versions/1.2.4/topics/age_calc