[R] How to pass function argument of same name to internal call?

From: Carl Witthoft <carl_at_witthoft.com>
Date: Fri, 25 Jul 2008 16:28:20 -0400


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



R-help_at_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. Received on Fri 25 Jul 2008 - 20:30:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 Jul 2008 - 23:32:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive