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
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,
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)
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,
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
__
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
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]]
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
8 matches
Mail list logo