Re: [R] Split dataframe by year

2014-02-11 Thread John Kane
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: zilefacel...@yahoo.com
> Sent: Mon, 10 Feb 2014 08:58:11 -0800 (PST)
> To: r-help@r-project.org, r-help-requ...@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@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!

__
R-help@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.


Re: [R] Split dataframe by year

2014-02-10 Thread Jeff Newmiller
Suggestions:

Read the posting guide mentioned at the bottom of this email. Note request to 
post in plain text and provide reproducible example. Knowing how your data are 
constructed allows us to make more concrete suggestions as to how Rio solve 
your problem.

Read help files: ?"%in%", ?subset, ?"<", ?"&". These may seem dense at first, 
but you eventually need to absorb them so get started.

Read the "Introduction to R" document that is supplied with the R software. In 
particular, read about indexing with logical vectors. 
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On February 10, 2014 8:58:11 AM PST, Zilefac Elvis  
wrote:
>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@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.

__
R-help@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.


Re: [R] Split dataframe by year

2014-02-10 Thread Rich Shepard

On Mon, 10 Feb 2014, Zilefac Elvis wrote:


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.


  If you want two separate dataframes (while leaving the original), subset()
based on the year. For example, one dataframe would select year < 1961 and
the other new dataframe would select year > 1960.

Rich

--
Richard B. Shepard, Ph.D.  |  Have knowledge, will travel.
Applied Ecosystem Services, Inc.   |
 Voice: 503-667-4517  Fax: 503-667-8863

__
R-help@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.


[R] Split dataframe by year

2014-02-10 Thread Zilefac Elvis
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@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.