samedi 5 avril 2014

create list based on data frame in R


Vote count:

0




I have a data frame A in the following format



user item
10000000 1 # each user is a 8 digits integer, item is up to 5 digits integer
10000000 2
10000000 3
10000001 1
10000001 4
..............


What I want is a list B, with users' names as the name of list elements, list element is a vector of items corresponding to this user.


e.g



B = list(c(1,2,3),c(1,4),...)


I also need to paste names to B.


Thanks



asked 32 secs ago

Jin

187





Aucun commentaire:

Enregistrer un commentaire