Have you considered simply changing your numbers into strings with as.character()?
E.g., library(vwr) levenshtein.distance("aba","cda") num1 <- 121; num2 <- 341 levenshtein.distance(as.character(num1),as.character(num2)) I find that last line a little verbose to type, so I'd write a little helper which adds some generality as well. LD <- function(s1, s2){ require(vwr) s1 = as.character(s1) s2 = as.character(s2) t(sapply(s1, levenshtein.distance, s2)) } Note that you can put vectors of numbers directly into LD(). Hope this helps, Michael On Thu, Oct 20, 2011 at 7:53 AM, Jörg Reuter <jo...@reuter.at> 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. > > Am 20.10.2011 13:32 schrieb "Mark Difford" <mark_diff...@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@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@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. > > ______________________________________________ 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.