我有一个函数定义为
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(...)
}
在这个函数中,我想判断用户是否在参数列表中输入"z".我该怎么做?我试过exists("z")
、missing("z")
和get("z")
,但都不管用.