Re: [R] Converting english words to numeric equivalents

From: Hans-Joerg Bibiko <bibiko_at_eva.mpg.de>
Date: Mon, 28 Jul 2008 12:23:58 +0200

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_at_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. Received on Mon 28 Jul 2008 - 10:26:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 28 Jul 2008 - 12:32:44 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive