Message-ID: <loom.20130717T191900-141@post.gmane.org>
Date: 2013-07-17T17:20:56Z
From: Ben Bolker
Subject: On the mechanics of function evaluation and argument matching
Brian Rowe <rowe <at> muxspace.com> writes:
>
> Thanks for the lead. Given the example in ?missing though,
> wouldn't it be safer to explicitly define a
> default value of NULL:
>
> myplot <- function(x, y=NULL) {
> if(is.null(y)) {
> y <- x
> x <- 1:length(y)
> }
> plot(x, y)
> }
>
[snip]
In my opinion the missing() functionality can indeed be
fragile (for example, I don't know how I can manipulate an
existing call to make an argument be 'missing' when it was
previously 'non-empty') and using an explicit NULL is often
a good idea. This makes the documentation a tiny bit less
wieldy if you have lots of parameters ...