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 -
There is also a third way, namely use the missing function
in the code:
f - function(x) if (missing(x)) print(missing) else print(x)
f()
On 10/16/06, Hans-Peter [EMAIL PROTECTED] wrote:
Hi,
I am troubled by the use of NULL or NA to indicate
missing/non-specified function arguments.
In the
On 10/16/2006 8:47 AM, Hans-Peter wrote:
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
2006/10/16, Duncan Murdoch [EMAIL PROTECTED]:
As Gabor said, the third way is to give no default, but test missing()
in the code.
I forgot this one, thank you. In my case it is probably not suited as
I just pass the arguments to a C (Pascal) function and do the checking
there.
[explanations
On 10/16/06, Hans-Peter [EMAIL PROTECTED] wrote:
2006/10/16, Duncan Murdoch [EMAIL PROTECTED]:
As Gabor said, the third way is to give no default, but test missing()
in the code.
I forgot this one, thank you. In my case it is probably not suited as
I just pass the arguments to a C (Pascal)
On 10/16/2006 5:06 PM, Brahm, David wrote:
Hans-Peter [EMAIL PROTECTED] wrote:
I am troubled by the use of NULL or NA to indicate
missing/non-specified function arguments.
I suggest using NULL for arguments which are vectors or lists of
unspecified length, and NA for scalars (arguments