On 14/09/2009, at 2:34 PM, Jack Tanner wrote:

Apologies for the noob question. I need to split setting up a plot and drawing it into two functions. One determines the properties of a plot (data, axis,
labels, etc.), and the other plots it (using a preferred device, image
dimensions, etc.).

get.props = function() {
  list(x=x, y=y, xlab="foo", ylab="bar")
}

myplot = function() {
  props = get.props()
  plot(props) # Doesn't work
}

What's the right way to call plot() with all the components of props broken out as separate parameters to plot()? Note that the components of props may be different from call to call (sometimes there's only x data, sometimes there's no
ylab, etc.).

Thanks in advance for your time and help.

do.call(plot,props)

See ?do.call .

        cheers,

                Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
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