[Rd] sort changes datatype of operand (PR#9121)
stephen.ponzio at citigroup.com
stephen.ponzio at citigroup.com
Thu Aug 3 16:34:45 CEST 2006
Full_Name: Stephen Ponzio
Version: 2.3.1
OS: Windows
Submission from: (NULL) (199.67.138.42)
Given a vector of dates, sort returns a vector of numerics instead of dates.
This is different from the behavior in version 2.2, where dates were returned.
In this respect, sort is not equivalent to order.
> dates <- seq(Sys.Date(), len=5, by="1 day")
> dates[order(dates)]
[1] "2006-08-03" "2006-08-04" "2006-08-05" "2006-08-06" "2006-08-07"
> sort(dates)
[1] 13363 13364 13365 13366 13367
> class(dates[order(dates)])
[1] "Date"
> class(sort(dates))
[1] "numeric"
More information about the R-devel
mailing list