merge_rec_data {cchsflow}R Documentation

Merge recoded data

Description

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.

Usage

merge_rec_data(...)

Arguments

...

recoded data frames to be merged.

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.

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.

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")
income2003 <- rec_with_table(cchs2001_p, "INCGHH_B")

income_merged <- merge_rec_data(income2001, income2003)
head(income_merged)
tail(income_merged)


[Package cchsflow version 2.1.0 Index]