[R] unexpected behaviour of 'curve' function

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sat Nov 27 02:28:49 CET 2004

Duncan Murdoch <murdoch at stats.uwo.ca> writes:

> Oops, not a bug, behaving as documented (but maybe a design flaw)?
> delay() is documented as defaulting to the global environment.
> curve() should have used "env=environment()".

Or not used delay() at all. That code looks a bit warped.

AFAICT, you could have 'from' defaulting to lims[1] and 'to' to
lims[2], then in the body let 

    if(missing(from) || missing(to))
        lims <- if(missing(xlim)) 
            if (par("xlog")) 
                10 ^ par("usr")[1:2] 

and get the same result (notwithstanding that you probably don't want
to use par("usr") in that way)

   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

More information about the R-help mailing list