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:
- Immigrant status
- Country of birth
- Ethnicity
- 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:
- Add a new category "Citizen born outside of Canada"
- 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)"))
Describe the bug
immigration_deris a categorical variable with the following categories:This issue is regarding the last category not applicable and how individuals are possible being incorrectly marked as not applicable
immigration_deris derived from the following variables: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:
To Reproduce
You can test this by running the following code. Make sure to source the function
immigration_funwhich is in the R fileR/immigration.R