As I understand it, get_exposure_ages just generates the ages of individuals within a serological sample. At the moment, it does the following:
determines the minimum birth year in the sample via min(serodata$birthyear)
determines the survey year by looking at the first row of the serodata and subtracting 1
creates a vector of ages from the minimum birth year to the year before the survey
But what if the data a user supplies does not have samples for all ages? Also, the requirements on the user are somewhat implicit, as the data frame needs to have columns named in a certain way. I'd propose changing this to:
As I understand it,
get_exposure_ages
just generates the ages of individuals within a serological sample. At the moment, it does the following:min(serodata$birthyear)
But what if the data a user supplies does not have samples for all ages? Also, the requirements on the user are somewhat implicit, as the data frame needs to have columns named in a certain way. I'd propose changing this to:
create_exposure_ages <- function(birthyears, survey_year)
where
birthyears
is a vector of birth years.