[R] sort dates

Gabor Grothendieck ggrothendieck at gmail.com
Fri Mar 9 15:02:04 CET 2012


On Fri, Mar 9, 2012 at 8:35 AM, carol white <wht_crl at yahoo.com> wrote:
> Hello,
> How is it possible to sort dates in R?
>

Your question has already been answered but note that if your data is
a time series and you represent it using zoo it will automatically be
sorted.  Here dates is in reverse chronological order whereas z, the
zoo time series object, is in chronological order:

values <- 13:10
dates <- as.Date("2000-01-01") + 3:0; dates

library(zoo)
z <- zoo(values, dates); z


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list