From tplate at acm.org  Thu Nov 18 01:46:45 2004
From: tplate at acm.org (Tony Plate)
Date: Thu Nov 18 01:46:59 2004
Subject: [Rd] Re: [R] changing (core) function argument defaults?
In-Reply-To: <Pine.A41.4.61b.0411171613130.86544@homer12.u.washington.ed
 u>
References: <BAY22-F8BBB2BB7E3C5D182A17A0A7C20@phx.gbl>
	<Pine.A41.4.61b.0411171613130.86544@homer12.u.washington.edu>
Message-ID: <6.1.0.6.2.20041117173647.05ebd910@mailhost.blackmesacapital.com>

Just to add to Thomas Lumley suggestion: it's generally a good idea to call 
a wrapper function it by a different name.  This way, when you forget that 
you have a wrapper function, you won't be puzzled by why the function 
doesn't behave according to the documentation, and you won't embarrass 
yourself by asking other people why there is a bug in R.  Also, if the 
function is called programmatically by other functions, those usages might 
be depending upon the standard defaults being in effect.  So, just do 
something like:

myX11<-function(display="",width=2,height=2,...){
    grDevices::X11(display=display,width=width,height=height,...)
}

-- Tony Plate

>At Wednesday 05:18 PM 11/17/2004, Thomas Lumley wrote:
>
>Restricted to r-devel (it is almost never appropriate to send the same 
>message to both lists).
>
>On Thu, 18 Nov 2004, RenE J.V. Bertin wrote:
> >From: Patrick Connolly &lt;p.connolly@hortresearch.co.nz>
> >To: &quot;RenE J.V. Bertin&quot; &lt;rjvbertin@hotmail.com>
> >Subject: Re: [R] changing (core) function argument defaults?
> >Date: Thu, 18 Nov 2004 11:43:10 +1300
>
> >
> >On Wed, 20-Oct-2004 at 07:48PM +0200, RenE J.V. Bertin wrote:
> >
> >|> Hello,
> >|>
> >
> >|> Is it possible to change the defaults for the arguments to a
> >|> function, without changing the function code itself?  I'm asking
> >|> because I'd like to override the default dimensions and font family
> >|> for a graphics device. Before 2.0.0, I'd just do that with a small
> >|> edit in the appropriate .R file containing the device function
> >|> definition. I appears to be possible no longer. So rather than
> >|> copying the definition into my own .Rprofile, it would be nice if
> >|> just the defaults could be modified...
> >
> >I didn't notice a response to this question.  I'd like to do something
> >similar and haven't been able to work out how to do it.
>
>You can write a wrapper
>
>X11<-function(display="",width=2,height=2,...){
>    grDevices::X11(display,width,height,...)
>}
>
>and put that into your Rprofile.
>
>         -thomas
>
>______________________________________________
>R-devel@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Re: [R] changing (core) function argument defaults?
Tony Plate