[R] how to get unique vectors

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Dec 19 23:36:33 CET 2001


Jason Liao <jg_liao at yahoo.com> writes:

> First, happy holidays, everyone! Thanks to the R team for bringing out
> 1.4 before the new year.
> 
> I have 10000 integer triplets stored in A[1:10000, 1:3]. I would like
> to find the unique triplets among the 10000 ones with possible
> duplications. What is the easiest way for this. I know the function
> unique(), which apply to a vector, not the 10000*3 array in my problem.

As of 1.4.0 (!):

unique(as.data.frame(A))

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list