[R] histogram of dates

From: Terry Therneau <therneau_at_mayo.edu>
Date: Fri, 22 Apr 2011 12:31:28 -0500

 I can't seem to get a histogram of dates:

tmt910% R --vanilla

R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0
> temp <- as.Date(1:200, origin="1970/01/01")
> range(temp)

[1] "1970-01-02" "1970-07-20"
> hist(temp)

Error in .Internal(inherits(x, what, which)) : 'x' is missing

> traceback()

3: inherits(breaks, "Date")
2: hist.Date(temp)
1: hist(temp)

Existence of hist.Date implies that this is intended to work. The MASS version fails in a different way.

> library(MASS)
> truehist(temp)

Error in Ops.difftime(n, 2) : '%/%' not defined for "difftime" objects
> sessionInfo()

R version 2.13.0 (2011-04-13)
Platform: x86_64-unknown-linux-gnu (64-bit)


 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods

other attached packages:
[1] MASS_7.3-12 Terry Therneau

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 22 Apr 2011 - 17:34:43 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 22 Apr 2011 - 18:50:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive