Re: [R] How to define mutualy exclusive parameters of a function

2018-04-26 Thread Rui Barradas
Hello, Inline. On 4/26/2018 5:42 PM, Berry, Charles wrote: On Apr 26, 2018, at 6:46 AM, Polychronis Kostoulas wrote: Dear All, apologies if this is basic: I am writing a function: fb<-function(mean, median, mode, a, b=0.95, lower=F) {} The arguments mean, median and mode are mutuall

Re: [R] How to define mutualy exclusive parameters of a function

2018-04-26 Thread Berry, Charles
> On Apr 26, 2018, at 6:46 AM, Polychronis Kostoulas > wrote: > > Dear All, > apologies if this is basic: I am writing a function: > > fb<-function(mean, median, mode, a, b=0.95, lower=F) > {} > > The arguments mean, median and mode are mutually exclusive (i.e. the user > should define o

Re: [R] How to define mutualy exclusive parameters of a function

2018-04-26 Thread Eric Berger
Hi Pol, Here is one way: fb <- function(mean=NULL, median=NULL, mode=NULL, a, b=0.95, lower=F) { stopifnot ( (is.null(mean) + is.null(median) + is.null(mode)) == 2 ) etc... } HTH, Eric On Thu, Apr 26, 2018 at 4:46 PM, Polychronis Kostoulas < polychronis.kostou...@gmail.com> wrote:

[R] How to define mutualy exclusive parameters of a function

2018-04-26 Thread Polychronis Kostoulas
Dear All, apologies if this is basic: I am writing a function: fb<-function(mean, median, mode, a, b=0.95, lower=F) {} The arguments mean, median and mode are mutually exclusive (i.e. the user should define only one of these). How do I code this within the function? Thanks, Pol [[al