R/adl.R
adl_score_5_fun.Rd
A 6 category variable (ADL_score_5) representing the number of activities of daily living tasks that require help. This variable tallies the number of daily living tasks that a respondent requires help with based on various ADL variables that a respondent answered yes or no to. The ADL variables used are common across all CCHS cycles from 2001 to 2014.
adl_score_5_fun(ADL_01, ADL_02, ADL_03, ADL_04, ADL_05)
A derived variable (ADL_score_5) with 6 categories:
0 - Needs help with 0 tasks
1 - Needs help with at least 1 task
2 - Needs help with at least 2 tasks
3 - Needs help with at least 3 tasks
4 - Needs help with at least 4 tasks
5 - Needs help with at least 5 tasks
# Use adl_score_5_fun() to create the variable ADL_score_5 across CCHS
# cycles adl_score_5_fun() is specified in variable_details.csv along with
# the CCHS variables and cycles included.
# To transform ADL_score_5, use rec_with_table() for each CCHS cycle
# and specify ADL_score_5, along with the various ADL variables.
# Then by using merge_rec_data() you can combine ADL_der across cycles.
library(cchsflow)
adl2001 <- rec_with_table(
cchs2001_p, c(
"ADL_01", "ADL_02", "ADL_03", "ADL_04", "ADL_05", "ADL_score_5"
)
)
#> No variable_details detected.
#> Loading cchsflow variable_details
#> Using the passed data variable name as database_name
#> NOTE for ADL_02: In the 2001 CCHS, respondents were asked, "Because of any condition or health problem, do you need the help of another person in shopping for groceries or other necessities?"
head(adl2001)
#> ADL_01 ADL_02 ADL_03 ADL_04 ADL_05 ADL_score_5
#> 1 2 2 2 2 2 0
#> 2 2 1 1 2 2 2
#> 3 2 2 2 2 2 0
#> 4 2 2 2 2 2 0
#> 5 2 2 2 2 2 0
#> 6 2 1 1 2 2 2
adl2009_2010 <- rec_with_table(
cchs2009_2010_p, c(
"ADL_01", "ADL_02", "ADL_03", "ADL_04", "ADL_05", "ADL_score_5"
)
)
#> No variable_details detected.
#> Loading cchsflow variable_details
#> Using the passed data variable name as database_name
#> NOTE for ADL_02: In the 2001 CCHS, respondents were asked, "Because of any condition or health problem, do you need the help of another person in shopping for groceries or other necessities?"
tail(adl2009_2010)
#> ADL_01 ADL_02 ADL_03 ADL_04 ADL_05 ADL_score_5
#> 195 2 2 2 2 2 0
#> 196 2 2 2 2 2 0
#> 197 2 2 2 2 2 0
#> 198 2 2 2 2 2 0
#> 199 2 2 2 2 2 0
#> 200 2 2 2 2 2 0
combined_adl <- merge_rec_data(adl2001, adl2009_2010)
head(combined_adl)
#> ADL_01 ADL_02 ADL_03 ADL_04 ADL_05 ADL_score_5
#> 1 2 2 2 2 2 0
#> 2 2 1 1 2 2 2
#> 3 2 2 2 2 2 0
#> 4 2 2 2 2 2 0
#> 5 2 2 2 2 2 0
#> 6 2 1 1 2 2 2
tail(combined_adl)
#> ADL_01 ADL_02 ADL_03 ADL_04 ADL_05 ADL_score_5
#> 395 2 2 2 2 2 0
#> 396 2 2 2 2 2 0
#> 397 2 2 2 2 2 0
#> 398 2 2 2 2 2 0
#> 399 2 2 2 2 2 0
#> 400 2 2 2 2 2 0
# Using adl_score_5_fun() to generate to ADL_score_5 based on user inputted
# values.
# Let's say you do not need help preparing meals, you need help getting to
# appointments or errands, you need help doing housework, do not need help
# doing personal care, and do not need help moving inside the house. Using
# adl_score_5_fun() we can check the number of tasks you need help with
ADL_score_5 <- adl_score_5_fun(2, 1, 1, 2, 2)
print(ADL_score_5)
#> [1] 2