[R] Split dataframe by year

John Kane jrkrideau at inbox.com
Tue Feb 11 16:38:04 CET 2014


first  <-  subset(dat1, dat1$var <=1960)  

Reverse inequality for the other one.

Hints on how to ask questions on R-help
https://github.com/hadley/devtools/wiki/Reproducibility
 http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

John Kane
Kingston ON Canada


> -----Original Message-----
> From: zilefacelvis at yahoo.com
> Sent: Mon, 10 Feb 2014 08:58:11 -0800 (PST)
> To: r-help at r-project.org, r-help-request at r-project.org
> Subject: [R] Split dataframe by year
> 
> Hi,
> I have a dataframe in R and would like to split the data (1900-1980) into
> two sets.
> For example, one dataframe should have data from 1900-1960 and the other
> from 1961-1980.
> Thanks for your help.
> AT.
> 	[[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.

____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!




More information about the R-help mailing list