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 expressi
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.
signature.asc
Description: Message signed with O
Richard,
I think the reason that this gives the warning is for the rest of us
who don't think about asking about missing values in non-data objects.
I could imagine someone choosing a poor name for a variable and doing
something like:
mean <- mean(x)
is.na(mean)
which would then tell them wheth
Maybe the way to rephrase my question is to ask why there is not
an is.na.expression method that does that task for me?
> is.na(as.list(expression("defg")))
[1] FALSE
> is.na(expression("defg"))
[1] FALSE
Warning message:
In is.na(expression("defg")) :
is.na() applied to non-(list or vector) of
It is in context of determining if an input argument for a graph title
is missing or null or na. In any of those cases the function defines
a main title.
If the incoming title is not one of those, then I use the incoming title.
When the incoming title is an expression I see the warning.
library(l
You can convert the expression to a list and use is.na on that:
> e <- expression(1+NA, NA, 7, function(x)x+1)
> is.na(as.list(e))
[1] FALSE TRUE FALSE FALSE
and you can do the same for a call object
> is.na(as.list(quote(func(arg1, tag2=NA, tag3=log(NA)
tag2 tag3
David,
Your answer begs the question.
What is the problem with non-(list or vector) of type language.
To my eye both expression(abcd) and call("mean") look like they have
non-missing values, hence I anticipated that they are not NA, and therefore
that is.na() would return FALSE without a warning.
> On Nov 18, 2015, at 5:54 PM, Richard M. Heiberger wrote:
>
> What is the rationale for the following warning in R-3.2.2?
>
>> is.na(expression(abcd))
> [1] FALSE
> Warning message:
> In is.na(expression(abcd)) :
> is.na() applied to non-(list or vector) of type ‘expression’
Well, the R inte
What is the rationale for the following warning in R-3.2.2?
> is.na(expression(abcd))
[1] FALSE
Warning message:
In is.na(expression(abcd)) :
is.na() applied to non-(list or vector) of type 'expression'
[[alternative HTML version deleted]]
__
9 matches
Mail list logo