Hi, thank you for your suggestion. This method seems to work for some variables, and not for others. For instance, if I try and run the following code, I keep getting the same output for the mean of 'AGE', despite changing the cutoff for the 'DEMENTIA_COHORTDATE1' variable, suggesting that the 'DEMENTIA_COHORTDATE1 >=2004' command is not being applied:
AGE <- Full_data %>%
select(AGE3, DEMENTIA_DEFINITE_ALL_2018, DEMENTIA_COHORTDATE1) %>%
filter(!is.na(AGE3), AGE3>=55, !is.na(DEMENTIA_DEFINITE_ALL_2018, !is.na(DEMENTIA_COHORTDATE1), DEMENTIA_COHORTDATE1>=2004)
Thanks again,
Renuka