[R] Question about collapse/aggregate and avoidance of loops
    Weiss, Bernd  
    bernd.weiss at uni-koeln.de
       
    Thu Jan 29 07:52:37 CET 2009
    
    
  
Dear all,
given the following data
## original data
id <- c(1,1,1,2,2,3)
author <- c("A","B","C","D","E","F")
tmp <- data.frame(id,author)
tmp
 > tmp
   id author
1  1      A
2  1      B
3  1      C
4  2      D
5  2      E
6  3      F
What is the best (most efficient/vectorized/avoiding loops) approach to 
obtain the following data frame?
id 	author
1	"A, B, C"
2 	"D, E"
3	"F"
Thanks for your help,
Bernd
 > version
                _
platform       i386-pc-mingw32
arch           i386
os             mingw32
system         i386, mingw32
status         Patched
major          2
minor          8.1
year           2008
month          12
day            22
svn rev        47296
language       R
version.string R version 2.8.1 Patched (2008-12-22 r47296)
    
    
More information about the R-help
mailing list