[R] adding a method to the dist function

Martin Maechler maechler at stat.math.ethz.ch
Mon May 3 14:21:09 CEST 2004


>>>>> "Giampiero" == Giampiero Salvi <giampi at speech.kth.se>
>>>>>     on Mon, 3 May 2004 14:01:23 +0200 (CEST) writes:

      ...................

    Giampiero> I agree that it would be better to use a new
    Giampiero> function (similar to mahalanobis), as the
    Giampiero> function dist in all the other cases uses raw
    Giampiero> data samples, and my interpretation of the input
    Giampiero> data might be confusing. The reason why I though
    Giampiero> of dist is that bhattacharyya is a symmetrical
    Giampiero> distance, and the result fits well the dist
    Giampiero> class.

    Giampiero> One way to solve this, if you agree, would be to
    Giampiero> write a new function bhattacharyya() that returns
    Giampiero> a dist object.

That sounds like a good idea (returning a "dist" object).
Do consider also setting the '$ method' component (e.g. to
"bhattacharyaa" or even something more specific) in the result.
Note that the help page for 'dist' has had a typo, calling the
component 'methods' instead of 'method'.

Martin




More information about the R-help mailing list