Re: [R] Selecting data based on the range of dates

2011-02-25 Thread Rob Tirrell
Try my.date <- strptime("20/2/06 11:16:16.683", "%d/%m/%y %H:%M:%OS") Then you can examine my.date$mon. -- Robert Tirrell | r...@stanford.edu | (607) 437-6532 Program in Biomedical Informatics | Butte Lab | Stanford University On Thu, Feb 24, 2011 at 14:12, Belle wrote: > > I think I got it,

Re: [R] Selecting data based on the range of dates

2011-02-25 Thread Belle
I think I got it, I post it here see if you have better way, please let me know. index <- rep(0, length(mydata[,1])) index[as.Date(mydata3$Date) < as.Date("2006-11-30 23:29:29 PM") & as.Date(mydata3$Date) > as.Date("2006-09-01 00:00:00 AM")] <- 1 index[as.Date(mydata3$Date) < as.Date("2007-11-30