I have a function defined as
myFun <- function(x, y, ...) {
# using exists
if (exists("z")) { print("exists z!") }
# using missing
try(if (!missing("z")) { print("z is not missing!") }, silent = TRUE)
# using get
try(if (get("z")) { print("get z!") }, silent = TRUE)
# anotherFun(...)
}
In this function, I want to check whether user input "z" in the argument list. How can I do that? I tried exists("z")
, missing("z")
, and get("z")
and none of them works.
missing
? Because AFAIK that's the correct function to use. – Lingermissing()
only applies for argument. Here there is no argumentz
, it can only be entered as part of...
– Violate