Hello I have 2 rows in a matrix and I want to calculate the Gower Distance between the 2 , how can I do it? I searched and found nothing that can help me, and my program doesn't know the gdist function and I couldn't find it on the R help site. Can anyone help me plz Thank u all [[alternative HTML version deleted]]
Roy Spitz pravi:> Hello > > > > I have 2 rows in a matrix and I want to calculate the Gower Distance between > the 2 , how can I do it? > I searched and found nothing that can help me, and my program doesn't know > the gdist function and I couldn't find it on the R help site. > > > > Can anyone help me plz > > > > Thank u all > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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. > >Look at the daisy function in the cluster package... hth, andrej
On Fri, 2006-11-17 at 14:50 +0200, Roy Spitz wrote:> Hello > > > > I have 2 rows in a matrix and I want to calculate the Gower Distance between > the 2 , how can I do it? > I searched and found nothing that can help me, and my program doesn't know > the gdist function and I couldn't find it on the R help site. > > > > Can anyone help me plzvegdist in package vegan has Gower's distance, but all variables have to be numeric. If you want to use mixed data (numerics, factors, binary), see ?daisy in package cluster. HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC & ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson wrote:> vegdist in package vegan has Gower's distance, but all variables have to > be numeric.> If you want to use mixed data (numerics, factors, binary), see ?daisy in > package cluster.This is a little unclear. vegdist will handle regular quantitative variables as well as binary variables. This is not so much a feature of vegdist as of the Gower similarity, which treats binary and quantitative variables identically, since a simple matching coefficient produces the same similarity value as is produced by Gower's quantitative similarity function for a variable that can take only two values. Perhaps that's what you meant, and I just misunderstood you. Perhaps I'm wrong, and someone will correct me! Cheers, Tyler