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 ...