Hi! I have a time variable which is coded "0, 1, 2 , 3," I want to recode this variable to be "--1.5, -0.5, 0.5, 1.5"
data1 <- data %>%
mutate(time = replace(time, time == 0, - 1.5 )) %>%
mutate(time = replace(time, time == 1, - 0.5 )) %>%
mutate(time = replace(time, time == 2, 0.5 )) %>%
mutate(time = replace(time, time == 3, 1.5 ))
i tried the following function, recode(data$time, "0" = - 1.5, "1" = -0.5, "2" = 0.5, "3" = 1.5)
But none of the functions would cooperate. Does anyone have any tips?