take precisely one named argument
"BXC (Bendix Carstensen)" <bxc at steno.dk> writes:
specify:
f <- function(...,a=NULL,b=NULL) {...etc
Or (variant of same)
f <- function(..., a, b) {
if (nargs() != 1 || length(list(...)))
stop("precisely one of a=x or b=y must be given")
else
if (missing(a)) 2*b else a
}
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907