merge_rec_data: Merge recoded data

Description Usage Arguments Details Value Examples

View source: R/merge-data.R

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

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 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)

cchsflow documentation built on June 24, 2021, 1:07 a.m.