[R] grouping data together

John Kane jrkrideau at yahoo.ca
Sat Nov 8 17:13:21 CET 2008

A very simple but long way to do this would be to subset your data set.  There are better ways but this way would be easy to understand. 
January <- subset(mydata, Month=="January")

Repeat for each month.

--- On Fri, 11/7/08, Swanton0822 <iverson0822 at hotmail.com> wrote:

> From: Swanton0822 <iverson0822 at hotmail.com>
> Subject: [R]  grouping data together
> To: r-help at r-project.org
> Received: Friday, November 7, 2008, 6:03 PM
> Hi.
> i have a data, and there is 3 columns, Month, Year and
> Total. and there is
> over 1000 rows for them because there is 87 years data for
> every month, so
> there is month from Jan-Dec, and year from 1900-1987,
> so i was wondering if i would want to make 12 groups
> (Jan,Feb.......,Dec),
> and put each year's total into the corresponding month
> (so every month group
> will have 88 values of total)
> how can i do that?
> many thanks.
> -- 
> View this message in context:
> http://www.nabble.com/grouping-data-together-tp20389726p20389726.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> 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.

[[elided Yahoo spam]]

More information about the R-help mailing list