Here are some R solutions. There is no need to bring in packages for such a straightforward task.
Suppose your data is the following:
d <- data.frame(variable = c("strongly disagree", "disagree", "agree", "strongly agree"))
If you don't care what code each string gets (as long as it is just consistent), then factors can do the work for you:
d$variable.r <- as.integer(as.factor(d$variable))
If you want to control the mapping, just make named vector and apply it like thus.
mapping <- c("strongly disagree" = 0, "disagree" = 1, "agree" = 2, "strongly agree" = 3)
d$variable.r <- mapping[d$variable]