Skip to content
Prev 43563 / 398506 Next

sorting by date

Convert to POSIXct and sort.

Note that tapply will coerce to a factor, so you need to create a factor 
with the levels sorted as you want them: just sorting date will not help.
Something like

udate <- unique(date)
lev <- udate[sort.list(as.POSIXct(strptime(udate, "%m/%d/%Y")))]
date <- factor(date, levels=lev)
On Mon, 2 Feb 2004, Jeff Jorgensen wrote: