User Tools

Site Tools


en:numecolr:grpdist

This script is part of supporting materials, coming with the book of Borcard et al. 2011.

To import the function definition directly into R, use the following:

source ('http://www.davidzeleny.net/anadat-r/doku.php/en:numecolr:grpdist?do=export_code&codeblock=1')
 
grpdist
# Function grpdist()
 
# Description: Computes a dissimilarity binary matrix from a vector with groups
# X : a vector containing integer numbers corresponding to groups (clusters).
 
# Usage: grpdist(X)
#
# License: GPL-2 
# Author: Daniel Borcard, January 2009
 
grpdist <- function(X)
{
require(cluster)
veg <- as.data.frame(as.factor(X))
distgr <- daisy(veg,"gower")
distgr
} 
en/numecolr/grpdist.txt · Last modified: 2017/10/11 20:36 (external edit)