[R] Crazy plots of time-series against dates

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue May 1 21:33:53 CEST 2001


"Marco Taboga" <mtaboga at tiscalinet.it> writes:

> OK, it works.  xlab and ylab had to be set properly.
> If you want to see what actually goes on, try:
> a<-chron(1:2000)
> b<-1:2000
> plot(a,b,type="l")
> 

One of the standard blunders with R's lazy evaluation and substitute is
to change the value of part of a substitute expression before it is
evaluated. I think the chron maintainer even inserted a note in the
FAQ about that (Hi, Kurt ;) )

In plot.times insert the line below to fix it

    if (!is.null(type <- dots$type)) 
        if (any(type == c("l", "b", "o"))) {
            xlab ; ylab  # force promises
            nas <- is.na(x)
            ...

Cc'ed to R-bugs so that it gets filed and eventually fixed.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list