sartene at voila.fr
2013-Oct-21 15:41 UTC
[R] tr: Aggregate values in one dataframe into a list of vectors of different sieze
I just found out what I was looking for, aggregate did the trick: AggregatedList <- aggregate(data = Sample, Value ~ Name, list) Hope this will help someone else! Sartene Bel> Message du 21/10/13 ? 16h29 > De : sartene at voila.fr > A : r-help at r-project.org > Copie ? : > Objet : Aggregate values in one dataframe into a list of vectors of different sieze > > Hi everyone, > > I have a data frame that is quite huge (dozens of millions of lines). > > It looks like this : > > Name????? Value > Name1??? 156 > Name2??? 458963 > Name3??? 758 > ... > Name143 89325 > Name1???? 4678 > Name42?? 766 > Name144 777 > ... > Name2???? 46767 > ... > > Each name and and value has no predefined length and may be repeated any number of times. > > My goal is to have a list (aggregating the numbers relative to each name, so to obtain a data frame which looks like this: > Name???? Values > Name1?? 156, 4678,... > Name2?? 458963, 46767... > ... > > Creating the unique names in the first column is easy via the unique function, but I did not find any way to regroup in matching vectors the different valuesaggregated for each name, of to directly create a data frame like I want.> > The ultimate goal is to use the values in the vectors to do some statistics (means, etc.), but that is another matter for later! > > Thanks for your help. > > > Sartene Bel > ___________________________________________________________ > Les pr?visions m?t?o pour aujourd'hui, demain et jusqu'? 8 jours ! Voila.fr http://meteo.voila.fr/___________________________________________________________ Les pr?visions m?t?o pour aujourd'hui, demain et jusqu'? 8 jours ! Voila.fr http://meteo.voila.fr/