On Wed, 2011-07-06 at 14:50 +0100, Sarah Leclaire wrote:> Hi,
>
> I would like to calculate the RELATIVE euclidean distance. Is there a
> function in R which does it ?
>
> (I calculated the abundance of 94 chemical compounds in secretion of
> several individuals, and I would like to have the chemical distance
> between 2 individuals as expressed by the relative euclidean distance.
> Some compounds are in very low abundance whereas others are in high
> abundance, that's why I would like to correct for the abundance)
>
> Thanks,
> Sarah
A simple solution to this is to transform the data and then compute the
Euclidean distance using dist().
decostand(foo, method = "normalize") and
disttransform(foo, method = "chord") in package BiodiversityR
can do this for you without you having to write a function yourself.
Pass the returned object to dist() to get the distances you want.
HTH
G
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, 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
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%