I have looked at similar posts but haven't gotten anything to work.
I have a column with characters 1,2,3,4,5 which are answers to interview questions I want a new column that when the response is 1 or 2 the new column is a No, when the response is 3 the new column is Partly, when the response is 4 or 5 is Yes, all else is NA.
data.frame': 405 obs. of 1 variables:
$ SQ023A : chr "-3" "-3" "-3" "-3" ...(this has -1, -2, -3, -4, 1, 2, 3, 4, 5, Yes, No, Partly)
The new column should keep the Yes, No, Partly answers but replace the 1 and 2 with No, 4 and 5 with Yes, and 3 with Partly. All else is NA.
I have tried the following without success
sq23$test <- ifelse(("1"|"2", sq23$SQ23A), "No",
ifelse("4"|"5", sq23$SQ23A), "Yes",
ifelse("3", sq23$SQ23A), "Partly","NA"))