I was looking into a data frame in which there are multiple user ids, many of them repeating e.g. in the following format
V1 V2 V3 V4
1002 2015-09-05 12:38:55 2953644 998999024421701
1002 2015-09-03 22:42:08 8495424 998999025009405
1004 2015-09-08 01:36:30 1498309 998999024420383
1005 2015-09-07 13:44:58 517720 998999024419011
Now I'm used to key-value pairs (being from a Java background) so the closest we get here are lists. On reading this, I tried working on a peculiar request.
Basically I want that for each unique id (V1 = 1002), I should be able to print all the rows associated with that id so the output would be something like this:
1002
2015-09-05 12:38:55 2953644 998999024421701
2015-09-03 22:42:08 8495424 998999025009405
1004
2015-09-08 01:36:30 1498309 998999024420383
1005
2015-09-07 13:44:58 517720 998999024419011
I tried using split as in here
xy.list <- setNames(split(g1, seq(nrow(g1))),g1$V)
but it won't club the results.