[R] adding a method to the dist function

Giampiero Salvi giampi at speech.kth.se
Mon May 3 13:00:48 CEST 2004


On Mon, 3 May 2004, Prof Brian Ripley wrote:

> On Mon, 3 May 2004, Giampiero Salvi wrote:
>
> > Hi all,
> > I'd like to add the Bhattacharyya method to the dist function.
> > What is the best way to do this? I'm using R 1.9.0 and I was looking
> > for the code that defines the already existing distances, but I didn't
> > manage. As far as I understand, dist is defined in mva that is part
> > of the stats package now, but where is the code?
>
> In src/library/stats/src/distance.c
>
> Where else did you think the C source code for the stats package would be
> but src/library/stats/src?

Sorry,
I was looking in the installation directory that of course
didn't have a src dir...

> You will need to add your own function, and BTW, I don't think `the
> Bhattacharyya method' is appropriate for dist, as it is defined for
> distributions, not data items.  It's even defined that way in your own
> paper

I also had the same doubt. My intension was to interpret the data matrix
as composed by vectors of means and covariances, but I did suspect that
this would generate some confusion. Do you have any suggestions on where
this method better belongs?

Thank you again,
Giampiero




More information about the R-help mailing list