From pflugshaupt@geobot.umnw.ethz.ch  Tue Feb  6 15:51:34 2001
From: pflugshaupt@geobot.umnw.ethz.ch (Kaspar Pflugshaupt)
Date: Tue, 6 Feb 2001 16:51:34 +0100
Subject: AW: [Rd] Proposal: Generalizing unique() and duplicated()
In-Reply-To: <Pine.GSO.4.31.0102061244320.453-100000@toucan.stats>
References: <Pine.GSO.4.31.0102061244320.453-100000@toucan.stats>
Message-ID: <01020616503101.00877@Aconitum>

On Tuesday 06 February 2001 13:49, Prof Brian Ripley wrote:

> Method dispatch is far from free (it is quite slow). Do we want to
> encumber unique() (a fast internal function) in this way?

That's a good argument. I did not know dispatch was such a problem in terms 
of speed. J. Oelschlgel suggested eliminating two dispatches by calling 

  return(duplicated.default(strvect)) 

instead of

  return(duplicated(strvect))

in both duplicated.matrix() and duplicated.data.frame().
But the speed gain, following your second argument, would probably be 
marginal. And the default methods would still get dispatched.

>
> There are better ways to do this if one is going to use C code:
> converting to character and comparing long strings are both expensive,

Since I cannot write C, this is not an option for me. I guess I'll take back 
my proposal and use the functions privately. I might publish them on r-help 
(in a non-dispatched form, not overloading the original functions), so others 
can use them as well.


Thanks for the feedback (I learned a lot)

Kaspar Pflugshaupt

----

Kaspar Pflugshaupt
Geobotanical Institute
ETH Zurich, Switzerland

http://www.geobot.umnw.ethz.ch
mailto:pflugshaupt@geobot.umnw.ethz.ch

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


AW: [Rd] Proposal: Generalizing unique() and duplicated()
Kaspar Pflugshaupt