Scott Waichler wrote:
> The handy function summary() doesn't work correctly with Date class
> objects:
>
>
>>R.version.string
>
> [1] "R version 1.9.1, 2004-06-21"
>
>>b <- as.Date(c("2002-12-26", "2002-12-27",
"2002-12-28", "2002-12-29", "2002-12-30"))
>>b
>
> [1] "2002-12-26" "2002-12-27" "2002-12-28"
"2002-12-29" "2002-12-30"
>
>>summary(b)
>
> Min. 1st Qu. Median Mean 3rd Qu.
Max.
> "2002-12-29" "2002-12-29" "2002-12-29"
"2002-12-29" "2002-12-29" "2002-12-29"
The obvious fix is to change summary.date (in
.../src/library/base/R/dates.R) as follows:
old:
summary.Date <- function(object, ...)
{
x <- summary.default(unclass(object), ...)[1:6]# not NA's
class(x) <- oldClass(object)
x
}
new:
summary.Date <- function(object, ...)
{
x <- unclass(object)
x <- summary.default(x, digits = floor(log(x)) + 1, ...)[1:6]# not
NA's
class(x) <- oldClass(object)
x
}
One might want to change "floor(log(x)) + 1" to something less
computational in intensive like "10". ;-)
Uwe Ligges
BTW: Should I submit a bug report or does anybody fix the sources at once?
> Scott Waichler
> Pacific Northwest National Laboratory
> Richland, WA 99352 USA
> scott.waichler at pnl.gov
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html