[R] advanced dist
s-plus at wiwi.uni-bielefeld.de
Wed Jun 2 10:13:49 CEST 2004
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)
> 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
> Is that possible somehow?
> And if possible, I would have the 'Code' at the top to know which
> mother and wich daugther are compared.
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide!
> mtdist<- as.matrix(dist(Fbg['Test']))
dimnames(mtdist) <- list( Fbg[ 'Family' ], Fbg[ 'Family' ] )
mtdist [ Fbg['Code']=="m" ,Fbg['Code']=="t" ]
More information about the R-help