[R] How to filter datetime from a dataframe

Rui Barradas ruipbarradas at sapo.pt
Wed Jul 25 10:52:56 CEST 2012


It's not the first time you post questions to R-Help, so
1. Where is the reproducible example?
2. The form you post [part of] your data example forces us to arrange it 
in order to become R code.

Try the following.

StartDate <- as.Date("01/Jul/2012", format="%d/%B/%Y")
EndDate <- as.Date("10/Jul/2012", format="%d/%B/%Y")

x <- as.Date("2012-06-01") + cumsum(sample(4, 20, TRUE))

inx <- StartDate < x & x < EndDate

Hope this helps,

Rui Barradas

Em 25-07-2012 08:05, purushothaman escreveu:
> I have one month data in a dataframe..
> I need to filter data based on start date and end date
> Ex: Start date :- 01/Jul/2012 and End date :- 10/Jul/2012
> Please help me to find the solution
> --
> View this message in context: http://r.789695.n4.nabble.com/How-to-filter-datetime-from-a-dataframe-tp4637721.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.

More information about the R-help mailing list