Hi there. I have now found that dist() does what I want in a specific case. But I have (out of many fields) in my Fragebogen.data file: Vpn Code Family Test 1 X1 m 45 2 X1 t 58 3 X2 m 44 4 X2 t 43 ... When I now do: Fbg <- read.table("Fragebogen.data", header=TRUE) dist(Fbg['Test']) I have the distances between everyone to everyone. Now I want to have the mothers (m in Family) at the y axis and the daugthers (t) on the x axis, so I have half the size of my distance matrix. Is that possible somehow? And if possible, I would have the 'Code' at the top to know which mother and wich daugther are compared. Thanks, Martin
Martin Klaffenboeck wrote:> Hi there. > > I have now found that dist() does what I want in a specific case. > > But I have (out of many fields) in my Fragebogen.data file: > > Vpn Code Family Test > 1 X1 m 45 > 2 X1 t 58 > 3 X2 m 44 > 4 X2 t 43 > ... > > When I now do: > Fbg <- read.table("Fragebogen.data", header=TRUE) > dist(Fbg['Test']) > I have the distances between everyone to everyone. > > Now I want to have the mothers (m in Family) at the y axis and the > daugthers (t) on the x axis, so I have half the size of my distance > matrix. > > Is that possible somehow? > > And if possible, I would have the 'Code' at the top to know which > mother and wich daugther are compared. > > Thanks, > Martin > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > R-project.org/posting-guide.htmlwhat about: > mtdist<- as.matrix(dist(Fbg['Test'])) dimnames(mtdist) <- list( Fbg[ 'Family' ], Fbg[ 'Family' ] ) mtdist [ Fbg['Code']=="m" ,Fbg['Code']=="t" ] Peter Wolf