How about this?

unletter <- function(word) {
gsub('-64',' ',paste(sprintf("%02d",utf8ToInt(tolower(word)) - 96),collapse=''))
}

unletter("abc")
[1] "010203"

unletter("Aw")
[1] "0123"

unletter("I walk to school")
[1] "09 23011211 2015 190308151512"

--Hans

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to