Hi all,
    Another one:

Given a data frame with two columns, where the first column (let's
call it 'id') has redundant entries, I'd like to get, for each unique
value in 'id', a list or vector of all the values from the second
column that corresponded to that value.

Example:

> df <- data.frame('id'=c('a','b','a','c','b','a'),'value'=c(6,4,2,9,1,7))
> df
  id value
1  a     6
2  b     4
3  a     6
4  c     9
5  b     1
6  a     7

I'd like some kind of output resembling something along these lines:

a: 6, 6, 7
b: 4, 1
c: 9

Any ideas would be appreciated!

Best,
Jonathan

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to