Created
September 14, 2012 17:49
-
-
Save cbare/3723488 to your computer and use it in GitHub Desktop.
Handling of missing arguments in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How the "missingness" status of arguments can be passed down | |
# the call stack. (Thanks Martin Morgan!) | |
bar <- function(q,...) { | |
cat(q) | |
foo(...) | |
} | |
foo <- function(a=123) { | |
if (missing(a)) | |
"I'm missing something" | |
else | |
"a ok" | |
} | |
Author
cbare
commented
Sep 14, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment