To date when writing R functions I've passed undefined arguments as NULL values and then tested whether they are NULL i.e.
f1 <- function (x = NULL) {
if(is.null(x))
...
}
However I recently discovered the possibility of passing undefined arguments as missing i.e.
f2 <- function (x) {
if(missing(x))
...
}
The R documentation states that
Currently missing can only be used in the immediate body of the function that defines the argument, not in the body of a nested function or a local call. This may change in the future.
Clearly this is one disadvantage of using missing to determine undefined values are there any others people or aware of? Or to phrase the question in a more useful form "When do you use missing versus NULL values for passing undefined function arguments in R and why?"