//This script is part of supporting materials, coming with the book of [[en:references|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')
# 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
}