[R] How to specify function arguments that are used in different places

2006-05-01 Thread Gregor Gorjanc
Hello! Subject is not very clear, but I hope my question will be;) I wrote a function, which produces a plot and I have problems with arguments. For the sake of example let us consider that my function looks like this myfunc - function(x, points=FALSE, lines=FALSE, ...) { ## x is an object

Re: [R] How to specify function arguments that are used in different places

2006-05-01 Thread Gabor Grothendieck
You could have a list of args for each one like this: # test data x - list(data = c(1,3,5), points = c(2,4)) myfunc - function(x, plot.args = NULL, points.args = NULL) { do.call(plot, c(list(x$data), plot.args)) do.call(points, c(list(x$points), points.args)) } myfunc(x,