Bojanowski, M.J. (Michal)
2006-Jun-23 16:27 UTC
[R] problem with hist() for 'times' objects from 'chron' package
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
Prof Brian Ripley
2006-Jun-23 16:46 UTC
[R] problem with hist() for 'times' objects from 'chron' package
As `Writing R Extensions' points out, using traceback() is often very informative. Here it gives> traceback()3: axis(2, adj = adj, cex = cex, font = font, las = las, lab = lab, mgp = mgp, tcl = tcl) 2: hist.times(dts) 1: hist(dts) and the problem is partial matching of 'lab' to 'labels'. This is discussed on the help page for axis, and in fact passing 'lab' to axis has never worked. Please report this to the package maintainer (as advised in the posting guide), and as a fix edit hist.times to remove ', lab=lab'. On Fri, 23 Jun 2006, Bojanowski, M.J. (Michal) 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 >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Gabor Grothendieck
2006-Jun-23 16:48 UTC
[R] problem with hist() for 'times' objects from 'chron' package
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 >