immigration_fun: Immigration by ethnicity and settlement

View source: R/immigration.R

immigration_funR Documentation

Immigration by ethnicity and settlement

Description

This function creates a categorical variable based on immigrant status (SDCFIMM), country of birth (SDCGCBG), ethnicity (SDCGCGT), and time in Canada (SDCGRES).

Usage

immigration_fun(SDCFIMM, SDCGCBG, SDCGCGT, SDCGRES)

Arguments

SDCFIMM

Immigrant status (1-immigrant, 2-non-immigrant)

SDCGCBG

Country of birth (1-Canada, 2-Outside of Canada)

SDCGCGT

Cultural or racial origin (1-white, 2-visible minority)

SDCGRES

Length/time in Canada since immigration (1- 0-9 years, 2- 10+ years)

Details

immigration_der uses the CCHS variables that have been transformed by cchsflow. In order to generate a value for BMI across CCHS cycles, the following SDC variables must be transformed and harmonized.

Value

Categorical variable (immigration_der) with six categories:

  • 1 - White Canada-born

  • 2 - Non-white Canadian born

  • 3 - White immigrant born outside of Canada (0-9 years in Canada)

  • 4 - Non-white immigrant born outside of Canada (0-9 years in Canada)

  • 5 - White immigrant born outside of Canada (10+ years in Canada)

  • 6 - Non-white immigrant born outside of Canada (10+ years in Canada)

Examples

# Using immigration_fun() to create immigration_der values across CCHS cycles
# immigration_fun() is specified in variable_details.csv along with the
# CCHS variables and cycles included.

# To transform immigration_der, use rec_with_table() for each CCHS cycle
# and specify immigration_der, along with the various SDC variables.
# Then by using merge_rec_data() you can combine immigration_der across cycles.

library(cchsflow)
immigration2001 <- rec_with_table(
  cchs2001_p, c(
    "SDCFIMM", "SDCGCBG", "SDCGCGT", "SDCGRES", "immigration_der"
  )
)

head(immigration2001)

immigration2009_2010 <- rec_with_table(
  cchs2009_2010_p, c(
    "SDCFIMM", "SDCGCBG", "SDCGCGT", "SDCGRES", "immigration_der"
  )
)

tail(immigration2009_2010)

combined_immigration <- merge_rec_data(immigration2001, immigration2009_2010)

head(combined_immigration)

tail(combined_immigration)


cchsflow documentation built on May 28, 2022, 1:09 a.m.