Skip to content

immigration_der and not applicable #139

@yulric

Description

@yulric

Describe the bug

immigration_der is a categorical variable with the following categories:

  • White Canada born
  • Non-white Canada born
  • White immigrant, 0 - 9 years in Canada
  • Non-white immigrant, 0 - 9 years in Canada
  • White immigrant, 10+ years in Canada
  • Non-white immigrant, 10+ years in Canada
  • missing
  • not applicable

This issue is regarding the last category not applicable and how individuals are possible being incorrectly marked as not applicable

immigration_der is derived from the following variables:

  1. Immigrant status
  2. Country of birth
  3. Ethnicity
  4. Length of time in Canada since immigration

Individuals who are not immigrants (Canadian citizens) but who are born outside of Canada are being marked as not applicable which does not seem right to me since this variable is still applicable. I'm not sure what the solution is but here are some:

  1. Add a new category "Citizen born outside of Canada"
  2. Lump them into one of the other categories but I'm not sure which one....

To Reproduce

You can test this by running the following code. Make sure to source the function immigration_fun which is in the R file R/immigration.R

print("Should print NA(a)")
# White citizens born outside of Canada
print(immigration_fun(2, 2, 1, "NA(a)"))
# Non-white citizens born outside of Canada
print(immigration_fun(2, 2, 2, "NA(a)"))

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions