В Wed, 30 Mar 2022 12:43:52 +0200
Göran Broström <goran.brost...@umu.se> пишет:

> That works, if I check for missing argument

> Is this the final word?

How about omitting it entirely and letting ... handle it?

table <- function(
 ..., useNA = "ifany", exclude = if (useNA == "no") c(NA, NaN),
 deparse.level = 1
) base::table(
 ..., useNA = useNA, exclude = exclude, deparse.level = deparse.level
)
table(c(1,1,2,NA))
#
#    1    2 <NA>
#    2    1    1
table(c(1,1,2,NA), dnn = 'a')
# a
#    1    2 <NA>
#    2    1    1


-- 
Best regards,
Ivan

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to