[R] ?plot: Add an example on how to plot functions to the help of `plot`.
dwinsemius at comcast.net
Thu Jul 28 00:04:18 CEST 2011
On Jul 27, 2011, at 5:53 PM, Paul Menzel wrote:
> as `plot.function` is not explicitly mentioned in `?plot`.
Right, but the fact that it _is_ described as a "generic" function
will tell the clueful that other methods other than the default method
may exist, and that their availability may vary with which packages
> One further comment regarding the examples in `?plot.function`. Trying
> those in order
> op <- par(mfrow = c(2, 2))
> chippy <- function(x) sin(cos(x)*exp(-x/2))
> plot (chippy, -8, -5)
> for(ll in c("", "x", "y", "xy"))
> curve(log(1+x), 1, 100, log = ll,
> sub = paste("log= '", ll, "'", sep = ""))
> I do not see any effect executing `par(op)` at the end. Reading `?
> par` I
> assume it should go before the for loop?
It has both a value and a side-effect. Pay particular attention to its
value for its first invocation. Then think about why its side-effect
is what you want _after_ the loop. Then you may understand what is
happening. Report back to the class. (This isn't in the Introductory
material you are reading?)
David Winsemius, MD
West Hartford, CT
More information about the R-help