Skip to content
Prev 301182 / 398503 Next

How to filter datetime from a dataframe

Hello,

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")

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

inx <- StartDate < x & x < EndDate
x[inx]

Hope this helps,

Rui Barradas

Em 25-07-2012 08:05, purushothaman escreveu: