I am very new to R, so sorry that I ask stupid things. I want compare a Matrix row by row and at the end I want to a Matrix with the Levenshtein-Distance. Example: The Data (Learningpath in a E-Learning-System): 5 12 24 35 1 24 35 3 35 35 45 35 Now I need a comand, which compare the first line with the second, then with the third and write the result in a new Matrix. I found many Funktion in R, but all compare Strings, but I have numbers. After that I want to use the ward-argorithm at the result. Can anyone give me a hint, I am at the end with my nervs. Joerg
check the help archives. hclust with method=ward might be what you are looking for On Wed, Oct 19, 2011 at 2:43 PM, J?rg Reuter <joerg at reuter.at> wrote:> I am very new to R, so sorry that I ask stupid things. > I want compare a Matrix row by row and at the end I want to a Matrix with > the Levenshtein-Distance. > Example: > The Data (Learningpath in a E-Learning-System): > 5 12 24 35 > 1 24 35 > 3 ?35 35 45 35 > Now I need a comand, which compare the first line with the second, > then with the third and write the result in a new Matrix. I found many > Funktion in R, but all compare Strings, but I have numbers. > After that I want to use the ward-argorithm at the result. > Can anyone give me a hint, I am at the end with my nervs. > > Joerg > > ______________________________________________ > 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. >
My big problem is not ward, it is to calculate the Levenshtein-Distance.> check the help archives. > > ?hclust ?with method=ward ?might be what you are looking for > > > > On Wed, Oct 19, 2011 at 2:43 PM, J?rg Reuter <joerg at reuter.at> wrote: >> I am very new to R, so sorry that I ask stupid things. >> I want compare a Matrix row by row and at the end I want to a Matrix with >> the Levenshtein-Distance. >> Example: >> The Data (Learningpath in a E-Learning-System): >> 5 12 24 35 >> 1 24 35 >> 3 ?35 35 45 35 >> Now I need a comand, which compare the first line with the second, >> then with the third and write the result in a new Matrix. I found many >> Funktion in R, but all compare Strings, but I have numbers. >> After that I want to use the ward-argorithm at the result. >> Can anyone give me a hint, I am at the end with my nervs. >> >> Joerg >> >> ______________________________________________ >> 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. >> >
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.
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111020/b7ca05ef/attachment.pl>
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