Re: [R] Converting english words to numeric equivalents

2008-07-28 Thread Barry Rowlingson
2008/7/28 Rolf Turner [EMAIL PROTECTED]: On 28/07/2008, at 12:32 PM, oscar Linares wrote: Hello, I am trying to convert english words to numeric equivalents, e.g., abc to 123. Is there a function or library or package for doing this in R? If not, can it be done easily in R? Your question

Re: [R] Converting english words to numeric equivalents

2008-07-28 Thread baptiste auguie
Here is my attempt at this (taking a specific understanding of the ill- defined equivalence relation), unletter - function(word){ word.broken - strsplit(word, NULL) set.of.numbers - sapply(word.broken[[1]], function(let) which(let == letters)) paste(set.of.numbers,

Re: [R] Converting english words to numeric equivalents

2008-07-28 Thread Ted Harding
On 28-Jul-08 09:29:22, baptiste auguie wrote: Here is my attempt at this (taking a specific understanding of the ill- defined equivalence relation), unletter - function(word){ word.broken - strsplit(word, NULL) set.of.numbers - sapply(word.broken[[1]], function(let)

Re: [R] Converting english words to numeric equivalents

2008-07-28 Thread baptiste auguie
As you point out, my proposed function does not verify an equivalence, and it is not restricted to english words. I'm probably too keen to see questions that call for an answer with relaxed assumptions (understand, that i can manage). Cheers, baptiste On 28 Jul 2008, at 10:47,

Re: [R] Converting english words to numeric equivalents

2008-07-28 Thread Hans-Joerg Bibiko
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 __

Re: [R] Converting english words to numeric equivalents

2008-07-28 Thread Hans-Joerg Bibiko
On 28 Jul 2008, at 12:23, Hans-Joerg Bibiko wrote: 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 I

[R] Converting english words to numeric equivalents

2008-07-27 Thread oscar Linares
Hello, I am trying to convert english words to numeric equivalents, e.g., abc to 123. Is there a function or library or package for doing this in R? If not, can it be done easily in R? Thanks, Oscar [[alternative HTML version deleted]]

Re: [R] Converting english words to numeric equivalents

2008-07-27 Thread Rolf Turner
On 28/07/2008, at 12:32 PM, oscar Linares wrote: Hello, I am trying to convert english words to numeric equivalents, e.g., abc to 123. Is there a function or library or package for doing this in R? If not, can it be done easily in R? Your question is very ill-posed. What ``english