Re: [R] Extracting months and years from Dates while keeping order

2011-05-06 Thread Dimitri Liakhovitski
Perfect - that's it, Gabor, thanks a lot! Dimitri On Fri, May 6, 2011 at 4:11 PM, Gabor Grothendieck wrote: > On Fri, May 6, 2011 at 4:07 PM, Dimitri Liakhovitski > wrote: >> Hello! >> >> I'd like to take Dates and extract from them months and years - but so >> that it sorts correctly. For examp

Re: [R] Extracting months and years from Dates while keeping order

2011-05-06 Thread Gabor Grothendieck
On Fri, May 6, 2011 at 4:07 PM, Dimitri Liakhovitski wrote: > Hello! > > I'd like to take Dates and extract from them months and years - but so > that it sorts correctly. For example: > > x1<-seq(as.Date("2009-01-01"), length = 14, by = "month") > (x1) > order(x1)  # produces correct order based o

[R] Extracting months and years from Dates while keeping order

2011-05-06 Thread Dimitri Liakhovitski
Hello! I'd like to take Dates and extract from them months and years - but so that it sorts correctly. For example: x1<-seq(as.Date("2009-01-01"), length = 14, by = "month") (x1) order(x1) # produces correct order based on full dates # Of course, I could do "format" - but this way I am losing t