Mark Heckmann
2008-Dec-11 16:01 UTC
[R] passing on the ... arguments in a progammed graphics function
Hi everyone, I want to write a wrapper function that uses the hist() function. Now I want to allow the hist breaks argument as optional in my function. So when my function contains the breaks argument I want the hist() function to use it, if not, I want the hist() function to use its default for breaks. How can I do that? myFunction <- function(data, ...) # breaks= as optional here { hist(data, breaks=???) } TIA Mark
Duncan Murdoch
2008-Dec-11 16:39 UTC
[R] passing on the ... arguments in a progammed graphics function
On 12/11/2008 11:01 AM, Mark Heckmann wrote:> Hi everyone, > > I want to write a wrapper function that uses the hist() function. Now I want > to allow the hist breaks argument as optional in my function. So when my > function contains the breaks argument I want the hist() function to use it, > if not, I want the hist() function to use its default for breaks. > How can I do that? > > myFunction <- function(data, ...) # breaks= as optional here > { > hist(data, breaks=???) > }If you make your call as hist(data, ...) then a breaks arg would be passed along (as would any other). Duncan Murdoch