This function allows users to merge CCHS data transformed by the rec_with_table function. This function generates a labelled merged data frame with multiple transformed CCHS cycles.

merge_rec_data(...)

Arguments

...

recoded data frames to be merged.

Value

a merged data frame consisting of multiple recoded CCHS cycles with labels for variable names and tags for variables not included in particular CCHS cycles.

Details

When merging recoded CCHS data, there are variables that are missing in certain CCHS cycles. This function tags missing variable observations as NA(c), indicating that the variable was not asked or included in the CCHS cycle of the respondent.

Click here for more details on how NA's are treated in cchsflow.

Examples

# Merging two CCHS cycles with variables missing in each cycle. # INCGHH_A is a cchsflow variable available for the 2001 CCHS cycle, while # INCGHH_B is a cchsflow variable available for the 2003 CCHS cycle. # Using merge_rec_data(), datasets containing INCGHH_A & INCGHH_B can be # merged and tagged. library(cchsflow) income2001 <- rec_with_table(cchs2001_p, "INCGHH_A")
#> No variable_details detected. #> Loading cchsflow variable_details
#> Using the passed data variable name as database_name
#> NOTE for INCGHH_A: CCHS 2001 classifies no income and less than $15,000 as separate categories
income2003 <- rec_with_table(cchs2001_p, "INCGHH_B")
#> No variable_details detected. #> Loading cchsflow variable_details
#> Using the passed data variable name as database_name
#> NOTE for INCGHH_B: CCHS 2001 classifies no income and less than $15,000 as separate categories
income_merged <- merge_rec_data(income2001, income2003) head(income_merged)
#> INCGHH_A INCGHH_B #> 1 3 NA(c) #> 2 3 NA(c) #> 3 6 NA(c) #> 4 3 NA(c) #> 5 4 NA(c) #> 6 4 NA(c)
tail(income_merged)
#> INCGHH_A INCGHH_B #> 395 NA(c) 3 #> 396 NA(c) 5 #> 397 NA(c) NA(b) #> 398 NA(c) 2 #> 399 NA(c) 1 #> 400 NA(c) 1