Re: [Rd] good practice for values not provided

2006-11-19 Thread Duncan Murdoch
On 11/19/2006 3:46 PM, Tamas K Papp wrote: > Hi, > > I am writing a collection of functions which I plan to share as a > package later (when they are tested thoroughly), so I would like to do > things "right" from the beginning... > > I encountered a minor question of style. Consider a function

Re: [Rd] good practice for values not provided

2006-11-19 Thread Gabor Grothendieck
One possibility is: f <- function(a, b, x) if (missing(x)) a+b else a-b-x although that does have the disadvantage that one cannot explicitly tell it not to use x but rather its denoted by its absence. On 11/19/06, Tamas K Papp <[EMAIL PROTECTED]> wrote: > Hi, > > I am writing a collection of fu

[Rd] good practice for values not provided

2006-11-19 Thread Tamas K Papp
Hi, I am writing a collection of functions which I plan to share as a package later (when they are tested thoroughly), so I would like to do things "right" from the beginning... I encountered a minor question of style. Consider a function f <- function(a,b,x=NULL) { ## ... } if !is.null(x),