On 25/07/2008 4:28 PM, Carl Witthoft wrote:
I ran across this problem when playing with ccf().
Its function call is

 >function (x, y, lag.max = NULL, type = c("correlation", "covariance"),
     plot = TRUE, na.action = na.fail, ...)

Internally, ccf() calls plot(), which digs up plot.acf() whose default style is type='h' .

I wanted to pass the argument type='l' to the plotting routine, but of course I can't put two arguments named "type" into the ccf() call. I made do with the work-around of writing "myccf," with the argument for the acf() call changed to "cortype," but that's ugly.

Is there a way to "escape" an argument so it gets ignored by the main function and only gets read by the internally-called function?

No. You should choose "plot=FALSE", save the result, then call plot() with your new arg for type.

For example, following the ?ccf example,

> ccfresult <- ccf(mdeaths, fdeaths, ylab = "cross-correlation", plot=FALSE)
> plot(ccfresult, type='l')

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to