[R] problem with hist() for 'times' objects from 'chron' package

Gabor Grothendieck ggrothendieck at gmail.com
Fri Jun 23 18:48:52 CEST 2006


Try this:

hist(as.Date(dts), "days") # or "weeks" or "months"

On 6/23/06, Bojanowski, M.J.  (Michal) <M.J.Bojanowski at fss.uu.nl> wrote:
> Hello dear useRs and wizaRds,
>
> I encountered the following problem using the hist() method for the
> 'times' classes
> from package 'chron'. You should be able to recreate it using the code:
>
>
>
> library(chron)
>
> # pasted from chron help file (?chron)
> dts <- dates(c("02/27/92", "02/27/92", "01/14/92", "02/28/92",
> "02/01/92"))
> class(dts)
>
> hist(dts) # which yields:
>
> # Error in axis(side, at, labels, tick, line, pos, outer, font, lty,
> lwd,  :
> #        'label' is supplied and not 'at'
> # In addition: Warning messages:
> # 1: "histo" is not a graphical parameter in: plot.window(xlim, ylim,
> log, asp, ...)
> # 2: "histo" is not a graphical parameter in: title(main, sub, xlab,
> ylab, line, outer, ...)
>
>
>
> The plot is produced, but there are no axes.
>
> As far as it goes for the warnings I looked in the sources and I think
> they are caused
> by hist.times() in package 'chron' which is calling the barplot() with
> the histo=TRUE,
> whereas neither barplot(), plot.window(), title() nor axis() seem to
> accept this argument.
>
> Am I doing something wrong or there is something not right with the
> hist.times method?
>
>
> Kind regards,
>
> Michal
>
>
>
>
>
> PS: I'm using R 2.3.1 on Windows XP and:
>
>
>
> > sessionInfo()
> Version 2.3.1 (2006-06-01)
> i386-pc-mingw32
>
> attached base packages:
> [1] "methods"   "stats"     "graphics"  "grDevices" "utils"
> "datasets"
> [7] "base"
>
> other attached packages:
>  chron
> "2.3-3"
> >
>
>
> library(help="chron")
>
> Package:       chron
> Version:       2.3-3
> Date:          2006-05-09
> Author:        S original by David James <dj at research.bell-labs.com>, R
>               port by Kurt Hornik <Kurt.Hornik at R-project.org>.
> Maintainer:    Kurt Hornik <Kurt.Hornik at R-project.org>
> Description:   Chronological objects which can handle dates and times
> Title:         Chronological objects which can handle dates and times
> Depends:       R (>= 1.6.0)
> License:       GPL
> Packaged:      Fri May 12 09:31:49 2006; hornik
> Built:         R 2.3.0; i386-pc-mingw32; 2006-05-13 12:21:51; windows
>
>
>
>
>
>
> ~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~
>
> Michal Bojanowski
> ICS / Utrecht University
> Heidelberglaan 2; 3584 CS Utrecht
> Room 1428
> m.j.bojanowski at fss.uu.nl
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



More information about the R-help mailing list