[R] How to pass function argument of same name to internal call?
Carl Witthoft
carl at witthoft.com
Fri Jul 25 22:28:20 CEST 2008
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?
thanks for any ideas.
Carl
More information about the R-help
mailing list