I have a dataframe with two date columns. All the dates in the Date2 column are the same.
Date1<-c("16/11/2007 17:00:00", "17/11/2007 01:02:00", "17/11/2007 05:00:00", "17/11/2007 09:00:00", "17/11/2007 13:00:00", "17/11/2007 17:00:00", "18/11/2007 01:00:00", "18/11/2007 05:00:00")
Date2<-rep("17/11/2007 17:00:00",times=8)
Data<-data.frame(Date1,Date2)
Data
Date1 Date2
16/11/2007 17:00:00 17/11/2007 17:00:00
17/11/2007 01:02:00 17/11/2007 17:00:00
17/11/2007 05:00:00 17/11/2007 17:00:00
17/11/2007 09:00:00 17/11/2007 17:00:00
17/11/2007 13:00:00 17/11/2007 17:00:00
17/11/2007 17:00:00 17/11/2007 17:00:00
18/11/2007 01:00:00 17/11/2007 17:00:00
18/11/2007 05:00:00 17/11/2007 17:00:00
I want to subset my data such that all dates in Date1 are equal to or LATER than the dates in Date2. Here's what the desired output would look like:
Data[4:8,]
Date1 Date2
17/11/2007 17:00:00 17/11/2007 17:00:00
18/11/2007 01:00:00 17/11/2007 17:00:00
18/11/2007 05:00:00 17/11/2007 17:00:00
Any help would be appreciated!