You need to write:
rstst=rsts[-which(rsts$date<as.Date('2011-03-01')),]
Here is what you had as the expression since it was not a Date object:
> 2011-03-01
[1] 2007
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
On Fri, Feb 28, 2014 at 4:20 PM, Bill <william108@gmail.com> wrote:
> Hello, I have a dataframe called rsts. It looks like this:
> > head(rsts)
> date Value
> 1 2012-08-07 45
> 2 2013-11-10 47
> 3 2014-01-28 28
> 4 2013-10-22 50
> 5 2013-06-13 35
> 6 2013-05-28 32
>
> where I ran as.Date(date) to get the date column as date objects.
>
> I tried this:
> rstst=rsts[-which(rsts$date<2011-03-01),]
>
> to remove dates earlier than March 1, 2011.
>
> But then I tried
> > summary(rstst)
>
> but I get this:
> date Value
> Min. :2006-06-28 Min. :-2.048e+09
> 1st Qu.:2012-07-27 1st Qu.: 3.300e+01
> Median :2013-03-09 Median : 4.100e+01
> Mean :2013-01-22 Mean :-5.831e+03
> 3rd Qu.:2013-08-09 3rd Qu.: 5.400e+01
> Max. :2051-04-01 Max. : 1.197e+08
>
> How can the Min be less than March 1 2011?
>
> Thanks
>
> [[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.
>
[[alternative HTML version deleted]]