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 snipped]
> So generally my advice would be:
> - Be consistent with similar existing functions.
> - Choose what you think will be convenient in current and predicted
> future versions of your function.

Ok, thank you. - Until now I always used NA but will (apart from your
advice) prefer NULL from now on. In C (Pascal) code NULL is also
easier to check than NA*

Thanks again and best regards,
Hans-Peter Suter


--
*
function riIsNull( _s: pSExp ): aRBoolean; cdecl;

vs.

function IsNaScalar( _x: pSExp ): boolean;
  begin
    result:= (riLength( _x ) = 1) and
             (riTypeOf( _x ) in [setLglSxp, setRealSxp]) and
             (rIsNa( riReal( riCoerceVector( _x, setRealSxp ) )[0] ) <> 0);
  end;

______________________________________________
R-help@stat.math.ethz.ch mailing list
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