I have a dataset and i trying to use mutate to replace or rename the data inside a column given different conditions.
I have generate a summary using code:
summary(s_r_data_no_na_split_rename_conv)
and show beclow info.
I am trying to make the changes as follow:
- 1 becomes "Some High School"
- 2 becomes "High School"
- 3 becomes "Vocational School"
- 4 becomes "College"
But i only can change 1 of the category and if i repeat using below code, the previous converted value become NA.
s_r_data_no_na_split_rename_conv_edu <- s_r_data_no_na_split_rename_conv %>% mutate(Education = ifelse(as.character(Education) == "1", "Some High School", as.factor(Education)))