[R] Aggregate data frame across columns

Bert Gunter gunter.berton at gene.com
Wed Nov 7 18:48:28 CET 2012


Have you read the Introduction to R tutorial? This is discussed there,
I believe. If you have not, please do so before posting here further.

But ...

?tapply
?aggregate
?ave

Also the plyr package for "user-friendlier" approaches.

-- Bert

On Wed, Nov 7, 2012 at 9:32 AM, Keith Weintraub <kw1958 at gmail.com> wrote:
> Folks,
>   I have a data frame with columns 200401, 200402, ..., 201207, 201208.
>
> These represent years/months. What would be the best way to sum these columns by year? What about by quarter?
>
> Thanks for your time,
> KW
>
> --
>
>
>         [[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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm




More information about the R-help mailing list