Try this:

DF <- data.frame( "Date" =
c("2009-09-01","2009-09-02","2009-09-03","2009-09-04",
"2009-09-05"), "Data" = c( 10:14 ) )
subset(DF, as.Date(Date) >= '2009-09-02' & as.Date(Date) <= '2009-09-04')


On Tue, Feb 1, 2011 at 11:09 AM, Usuario R <r.user.sp...@gmail.com> wrote:

> Hello,
>
> I have a data frame with one column set as the date with function as.Date.
>
> In example:
>
> data.frame( "Date" = c("2009-09-01","2009-09-02","2009-09-03","2009-09-04",
> "2009-09-05"), "Data" = c( 10:14 ) )
>
> Date Data
>  2009-09-01   10
>  2009-09-02   11
>  2009-09-03   12
>  2009-09-04   13
>
> Is there a way to subset my data frame by a period of time?
> In the example above I would need to extract data from: 2009-09-02 to
> 2009-09-04 for example.
>
> Then the result would be:
>
> Date Data
>  2009-09-02   11
>  2009-09-03   12
>  2009-09-04   13
>
> Thanks in advance.
>
>        [[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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[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.

Reply via email to