[R] NULL or NA for missing function arguments?

Hans-Peter gchappi at gmail.com
Mon Oct 16 14:47:18 CEST 2006


Hi,

I am troubled by the use of NULL or NA to indicate
missing/non-specified function arguments.

In the R code that I have looked at, it seems that both forms are used
(NULL seems to be used more often though). Sometimes both variants are
in the same declaration, e.g.

format.default <-
    function(x, trim = FALSE, digits = NULL, nsmall = 0,
	     justify = c("left", "right", "centre", "none"),
	     width = NULL, na.encode = TRUE, scientific = NA,
	     big.mark = "", big.interval = 3,
	     small.mark = "", small.interval = 5, decimal.mark = ".",
	     zero.print = NULL, ...)

Is there a right way? And if both forms are used, how do I know which
one is right?

Thanks a lot and best regards,
Hans-Peter



More information about the R-help mailing list