r - Turning into data.frame into a list based on ids -


i have data.frame:

df <- data.frame(id=c(1,1,2,2), event=c("merged", "discussed", "merged", "discussed"))  

now want turn list, in such way list contains 2 entries - 1 each id (i.e. 1 , 2), , records correspond entries, such:

list of 2:  [1] name: "1", data.frame    id     event  1  1    merged  2  1 discussed  [2] name: "2", data.frame   id      event  1  2    merged  2  2 discussed 

obviously looking generalizable solution scale beyond minimal example.

try split

split(df, df$id) 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -