I have some data that I'm working with from a Udacity course (Link: Reddit Survey Responses). I'm trying to simplify the Employment Status variable by replacing any multi-word values with single word alternates using
RS$employment.status <- ifelse(RS$employment.status == "Not employed, but looking for work",
"Unemployed", RS$employment.status)
However, when I run the code any values that aren't supposed to be replaced are replaced with numeric values. Given that the else case is to use the field's value, I'm not sure why the text isn't preserved as-is.
Here's a screenshot of the initial data
So if anyone could point out
- why the substitution is being made when it doesn't look like it should be;
- what would be the correct way to accomplish what I'm trying to achieve;
it would be much appreciated.