[R] is.na behavior

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Thu Nov 19 22:52:08 CET 2015


I don't think the question is about what an expression evaluates to,  but what it is.

I don't think it makes sense for an expression to be NA, but I am not a language designer.  The expression NA tells the compiler that a literal NA_logical_ value is to be returned from evaluating that expression,  but that is not what the expression itself is. Nor is it a no-operation... that has a different meaning than "unknown value".

I would construct a function that simply returns NA and use that as the default value for the function that the OP constructed, and always call the function rather than testing what it is. 

On November 19, 2015 12:59:33 PM PST, Erich Neuwirth <erich.neuwirth at univie.ac.at> wrote:
>I am not sure I undestand the issue.
>But if the question is to decidedif an expression evaluates to NA,
>using eval should solve the problem.
>In fact, I do not really understand what an NA expression, and not an
>expression evaluating to NA,
>means.
>
>
>
>------------------------------------------------------------------------
>
>______________________________________________
>R-help at 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.

-- 
Sent frommy phone. Please excuse my brevity.
	[[alternative HTML version deleted]]



More information about the R-help mailing list