On 24-Nov-04 Prof Brian Ripley wrote: > On Wed, 24 Nov 2004 [EMAIL PROTECTED] wrote: > >> 1. Multiply the data by some factor and then round the >> results to an integer (to avoid problems in step 2). >> Factor chosen so that the result of (4) below is >> satisfactory. >> >> 2. Eliminate duplicates in the result of (1). >> >> 3. Divide by the factor you used in (1). >> >> 4. Plot the result; save plot to PDF. >> >> As to how to do it in R: the critical step is (2), >> which with so many points could be very heavy unless >> done by a well-chosen procedure. I'm not expert enough >> to advise about that, but no doubt others are. > > unique will eat that for breakfast > >> x <- runif(1e6) >> system.time(xx <- unique(round(x, 4))) > [1] 0.55 0.09 0.64 0.00 0.00 >> length(xx) > [1] 10001
'unique' will eat x for breakfast, indeed, but will have some trouble chewing (x,y). I still can't think of a neat way of doing that. Best wishes, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 094 0861 [NB: New number!] Date: 25-Nov-04 Time: 00:37:15 ------------------------------ XFMail ------------------------------ ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
