I want to recode some numeric values into different numeric values and have had a go using the following code:
survey$KY27PHYc <- revalue(survey$KY27PHY1, c
Try this:
#sample data set.seed(123); x <- sample(1:5, size = 10, replace = TRUE) x # [1] 2 4 3 5 5 1 3 5 3 3 #recode x <- c(1, 1, 2, 2, 3)[ x ] x # [1] 1 2 2 3 3 1 2 3 2 2