[R] avoiding "multiple actual arguments" in default function behavior

2014-02-05 Thread Dustin Fife
Suppose I'm creating a function that sets default ylab and xlab behaviors: plotx = function(x, y, ...){ plot(x,y, ylab="", xlab="",...) } The problem is, on occasion, I actually want to override the defaults in my function. I would like to do the following: plotx(1:100, 1:100, xlab="I Don't

Re: [R] avoiding "multiple actual arguments" in default function behavior

2014-02-05 Thread William Dunlap
.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Dustin Fife > Sent: Wednesday, February 05, 2014 8:11 AM > To: r-help > Subject: [R] avoiding "multiple actual arguments" in default funct

Re: [R] avoiding "multiple actual arguments" in default function behavior

2014-02-05 Thread Dustin Fife
IBCO Software > wdunlap tibco.com > > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On >> Behalf >> Of Dustin Fife >> Sent: Wednesday, February 05, 2014 8:11 AM >> To: r-help >

Re: [R] avoiding "multiple actual arguments" in default function behavior

2014-02-05 Thread arun
Hi, Try:  plotx <- function(x,y, ...){  labels <- list(xlab="x",ylab="y")  args <- modifyList(labels,list(x=x,...))  do.call("plot",args)  }  plotx(1:100,1:100,xlab="I Don't Work!") A.K. On Wednesday, February 5, 2014 11:14 AM, Dustin Fife wrote: Suppose I'm creating a function that sets def

Re: [R] avoiding "multiple actual arguments" in default function behavior

2014-02-05 Thread Dustin Fife
Perfect. Thanks! On Wed, Feb 5, 2014 at 10:35 AM, arun wrote: > Hi, > Try: > > plotx <- function(x,y, ...){ > labels <- list(xlab="x",ylab="y") > args <- modifyList(labels,list(x=x,...)) > do.call("plot",args) > } > > plotx(1:100,1:100,xlab="I Don't Work!") > A.K. > > > On Wednesday, Febr