[R] Grouping data in dataframe
Timo Schneider
timo.schneider at s2004.tu-chemnitz.de
Wed Jul 15 17:21:11 CEST 2009
Am Mittwoch, den 15.07.2009, 00:42 -0500 schrieb markleeds at verizon.net:
Hi!
> Hi: I think aggregate does what you want. you had 34 in one of your
> columns but I think you meant it to be 33.
>
> DF <- read.table(textConnection("ExpA ExpB ExpC Size
> 1 12 23 33 1
> 2 12 24 29 1
> 3 10 22 34 1
> 4 25 50 60 2
> 5 24 53 62 2
> 6 21 49 61 2"),header=TRUE)
>
> print(DF)
> print(str(DF))
>
> aggregate(DF,list(DF$Size),median)
Yes, thanks to you and all the other people who helped! The aggregate
function is exactly what I was looking for. Thanks for the help!
Regards,
Timo
More information about the R-help
mailing list