[R] turning a list into a function's params
    Jack Tanner 
    ihok at hotmail.com
       
    Mon Sep 14 04:34:02 CEST 2009
    
    
  
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.
    
    
More information about the R-help
mailing list