I had a question on the ifelse function. I am trying to create a new column (race_ethn) which is the combination of the Race column and Ethnicity column based on the following logic:
If Ethnicity = Hispanic or Latino, then we want to keep the value in the Ethnicity column (which is Hispanic or Latino, ALL ELSE, we want to keep the value in the Race column.
I tried using this code below in my pipeline and keep getting an error. I am assuming it is because I am using columns instead of operators.
mutate(race_ethn = ifelse(Ethnicity = “Hispanic or Latino”, Ethnicity, Race))
I attached a sample dataset to help solve this inquiry.
Thanks in advanced.
Sample Data.txt (322 Bytes)