Where is list.names?
On 2022-03-30 11:48, Ivan Krylov wrote:
? Wed, 30 Mar 2022 11:27:05 +0200 G?ran Brostr?m <goran.brostrom at umu.se> ?????:
I can guess what 'list.names' is (from the documentation), but where and how is it defined?
Interesting! It's defined first thing inside the function, so by the time the function tries to use the argument, list.names exists and can be called, but for all other purposes, it's not there.
Thanks for that (also thanks to Eric)!
What if you don't set a default value for dnn in your wrapper or
That works, if I check for missing argument:
table <- function(...,
useNA = "ifany",
exclude = if (useNA == "no") c(NA, NaN),
dnn,
deparse.level = 1){
if (missing(dnn)){
base::table(...,
exclude = exclude,
useNA = useNA,
deparse.level = deparse.level)
}else{
base::table(...,
useNA = useNA,
exclude = exclude,
dnn = dnn,
deparse.level = deparse.level)
}
}
Is this the final word?
G?ran
even mention dnn as a formal argument in your wrapper? In many cases, it's possible to forward missing arguments to functions and have them do the right thing. The only other solution I can think of is non-standard evaluation.