On Oct 21, 2011, at 1:57 AM, Jörg Reuter wrote:

Hi,
I am very happy. My problems are solved without one little thing:

(Iske <- matrix(c(1, 1, 1, 2, 2, 2, 1, 1, 1, 5, 1, 2, 2, 2, 1, 1, 1,
4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 4, 4, 4, 4, 2,
2, 2, 2, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 2), ncol = 5)) #My Matrix

First transform to characters. (Using raw type seems failure-prone):

Iltrs <- c(letters, LETTERS)[Iske]

Then work with that.

(No testing in absence of the levenshtein.distance function definition or package location.)


Iske<- Iske+33 #I want see the letters

(Iske.char<-apply(Iske, 1, function(x) rawToChar(as.raw(x)))) #Numbers to Char
LD <- function(s1, s2){
   require(vwr)
   s1 = as.character(s1)
   s2 = as.character(s2)
   t(sapply(s1, levenshtein.distance, s2))
}
Iske.levens<-(LD(Iske.char,Iske.char)) #Calculate the Levenshtein- Distanz

The result:
!"#$% !"#$% !"#$% "!#$% ....
!"#$%     0     0     0
!"#$%     0     0     0
!"#$%     0     0     0
.
.
.
It is all beautiful. But is there a simple way to change the
column/row-name to the original from the Matrix Iske?

Thanks a lot for the help yesterday. It was a big step in my life :-)

______________________________________________
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.

David Winsemius, MD
West Hartford, CT

______________________________________________
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.

Reply via email to