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
.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
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
>
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
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
5 matches
Mail list logo