[R] question about sum of (column) elements in R
Gerrit Eichner
Gerrit.Eichner at math.uni-giessen.de
Tue Dec 4 10:11:32 CET 2012
Hi, T. Bal,
homework? Take a look at
?tapply
Regards -- Gerrit
On Tue, 4 Dec 2012, T Bal wrote:
> Hi,
> I have the following data:
>
> 0 12
> 1 10
> 1 4
> 1 6
> 1 7
> 1 13
> 2 21
> 2 23
> 2 20
> 3 18
> 3 17
> 3 16
> 3 27
> 3 33
> 4 11
> 4 8
> 4 19
> 4 16
> 4 9
>
>
> In this data file I would like to sum the numbers of second column which
> belong to the same number in the first column.
> So the output would be:
>
> 0 12
> 1 40
> 2 64
> 3 111
> etc.
>
> Thank you.
>
> Kind regards,
> T. Bal
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list