[R] Levenshtein-Distance

David Winsemius dwinsemius at comcast.net
Thu Oct 20 16:27:27 CEST 2011


On Oct 20, 2011, at 7:53 AM, Jörg Reuter wrote:

> Yes, I see many package. But the Problem is, the Package compare  
> strings.
> But there is a diffrent between the caracter 1 and 2 and the number  
> "12".
> All package I see compare every letter, but a number have many  
> digits but
> the digits make only sense if the function see them together. I  
> tough to
> change the number in caracter like 1->a but I have to much numbers.

I get the sense you and your respondents are talking paste each other,  
and that you do _not_ want to compare the digits in your numbers. If  
you have a vector that you want to change into a character, you can  
convert easily with indexing. This would give you a "domain" of 48  
characters:

....ooops, you are one of those Nabble users who expects us to search  
for your  prior postings.... tooo bad. I have decided not to track  
down omitted context in such instance:

 > c(letters,LETTERS)[ c(12, 35, 24, 35)]
[1] "l" "I" "x" "I"   # then use the distance function

There are numToASCII functions but I cannot remember them without  
searching.

-- 
David.
>
> Am 20.10.2011 13:32 schrieb "Mark Difford" <mark_difford at yahoo.co.uk>:
>>
>> On Oct 20, 2011; 10:07am  Jörg Reuter wrote:
>>
>>> I want compare a Matrix row by row and at the end I want to a Matrix
> with
>>> the Levenshtein-Distance.
>>
>> Jörg,
>>
>> To begin with, try the following at the command prompt:
>>
>> ##
>> RSiteSearch("Levenshtein")
>>
>> Shows, amongst other hits, that package vwr has a function to  
>> calculate
>> Levenshtein distances.
>>
>> Regards, Mark.
>>
>> -----
>> Mark Difford (Ph.D.)
>> Research Associate
>> Botany Department
>> Nelson Mandela Metropolitan University
>> Port Elizabeth, South Africa
>> --
>> View this message in context:
> http://r.789695.n4.nabble.com/Levenshtein-Distance-tp3920951p3921252.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> 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.
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list