[R] unique deletes names - intended?

From: Heinz Tuechler <tuechler_at_gmx.at>
Date: Wed 05 Jul 2006 - 02:33:15 EST

Dear All,

as shown in the example, unique() deletes names of vector elements. Is this intended?
Of course, one can use indexing by !duplicated() instead.


## unique deletes names
v1 <- c(a=1, b=2, c=3, e=2, a=4)
unique(v1) # names deleted

v1[!duplicated(v1)] # names preserved

platform       i386-pc-mingw32                          
arch           i386                                     
os             mingw32                                  
system         i386, mingw32                            
status         Patched                                  
major          2                                        
minor          3.1                                      
year           2006                                     
month          07                                       
day            01                                       
svn rev        38471                                    
language       R                                        
version.string Version 2.3.1 Patched (2006-07-01 r38471)

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 05 02:41:57 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 05 Jul 2006 - 22:16:15 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.