Skip to content
Prev 257758 / 398502 Next

histogram of dates

On Apr 22, 2011, at 12:31 PM, Terry Therneau wrote:

            
Hi Terry,

Try this:

  temp <- as.Date(1:200, origin="1970/01/01")

  hist(temp, breaks = "months")


There is no default for the 'breaks' argument in hist.Date() and there does not appear to be a check for a missing value for this argument.

truehist() does not have a method for Date class objects, but you could do:

  truehist(as.numeric(temp))

or perhaps use cut.Date() on the vector and create the intervals/breakpoints that you wish to use.

HTH,

Marc Schwartz