[R] aggregating dates
Paul Sorenson
Paul.Sorenson at vision-bio.com
Mon Jan 31 06:16:35 CET 2005
I have a frame which contains 3 columns:
"date" "defectnum" "state"
And I want to get the most recent state change for a given defect number. date is POSIXct.
I have tried:
aggregate(ev$date, by=list(ev$defectnum), max)
Which appears to be working except that the dates seem to come back as integers (presumably the internal representation of POSIXct).
When I execute max(ev$date) the result remains POSIXct.
I have been dredging through the help among DateTimeClasses and haven't found a function that converts these integers to some kind of date class. Or a method for using aggregate which doesn't perform the conversion in the first place.
Any clues?
More information about the R-help
mailing list