On May 3, 2013, at 10:58 PM, peter dalgaard wrote:
>
> On May 3, 2013, at 21:36 , David Winsemius wrote:
>
>>
>> On May 3, 2013, at 10:46 AM, peter dalgaard wrote:
>>>
>>>
>>> Because comparison with an unknown value yields an unknown result.
>>
>> Anything else would violate the Second La
On May 3, 2013, at 21:36 , David Winsemius wrote:
>
> On May 3, 2013, at 10:46 AM, peter dalgaard wrote:
>>
>>
>> Because comparison with an unknown value yields an unknown result.
>
> Anything else would violate the Second Law of Thermodynamics. We cannot have
> comparisons reducing entrop
On May 3, 2013, at 10:46 AM, peter dalgaard wrote:
>
> On May 3, 2013, at 17:24 , jpm miao wrote:
>
>> I have a program, when I write
>>
>> if(num!=NA)
>>
>> it yields an error message.
>>
>> However, if I write
>>
>> if(is.na(num)==FALSE)
>>
>> it works.
>>
>> Why doesn't the first state
>
> On May 3, 2013, at 17:24 , jpm miao wrote:
>
>> I have a program, when I write
>>
>> if(num!=NA)
>>
> snipped
On May 3, 2013, at 10:46 AM, peter dalgaard wrote:
> Because comparison with an unknown value yields an unknown result.
Anything else would violate the Second Law of Thermody
On May 3, 2013, at 17:24 , jpm miao wrote:
> I have a program, when I write
>
> if(num!=NA)
>
> it yields an error message.
>
> However, if I write
>
> if(is.na(num)==FALSE)
>
> it works.
>
> Why doesn't the first statement work?
Because comparison with an unknown value yields an unknown
At a minimum, the first statement needs "==".
Also, is.na() gives TRUE/FALSE. While a logical comparison to NA gives NA
as a value.
Kevin
On Fri, May 3, 2013 at 10:24 AM, jpm miao wrote:
> I have a program, when I write
>
> if(num!=NA)
>
> it yields an error message.
>
> However, if I write
ftware
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of jpm miao
> Sent: Friday, May 03, 2013 8:25 AM
> To: r-help
> Subject: [R] Why can't R understand if(num!=NA)?
>
> I have a progra
num1<- c(0,NA,1,3)
num1==NA
#[1] NA NA NA NA
num1!=NA
#[1] NA NA NA NA
is.na(num1)
#[1] FALSE TRUE FALSE FALSE
A.K.
- Original Message -
From: jpm miao
To: r-help
Cc:
Sent: Friday, May 3, 2013 11:24 AM
Subject: [R] Why can't R understand if(num!=NA)?
I have a program
On 03-05-2013, at 17:24, jpm miao wrote:
> I have a program, when I write
>
> if(num!=NA)
>
> it yields an error message.
>
it?
What is unclear about the error message?
> However, if I write
>
> if(is.na(num)==FALSE)
>
> it works.
>
> Why doesn't the first statement work?
>
Read sectio
On May 3, 2013, at 8:24 AM, jpm miao wrote:
> I have a program, when I write
>
> if(num!=NA)
>
> it yields an error message.
>
> However, if I write
>
> if(is.na(num)==FALSE)
>
> it works.
>
> Why doesn't the first statement work?
Read the "manual":
?"NA"
--
David Winsemius
Alameda,
On May 3, 2013, at 10:24 AM, jpm miao wrote:
> I have a program, when I write
>
> if(num!=NA)
>
> it yields an error message.
>
> However, if I write
>
> if(is.na(num)==FALSE)
>
> it works.
>
> Why doesn't the first statement work?
>
> Thanks,
>
> Miao
NA is undefined:
> NA == NA
[1]
Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of jpm miao
Sent: Friday, May 3, 2013 10:25 AM
To: r-help
Subject: [R] Why can't R understand if(num!=N
You can use only
if(!is.na(num))
[[alternative HTML version deleted]]
__
R-help@r-project.org 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 com
> -Original Message-
> if(num!=NA)
> it yields an error message.
> Why doesn't the first statement work?
Because you just compared something with NA (usually interpreted as 'missing')
and because of that the comparison result is also NA.
'if' then tells you that you have a missing va
I have a program, when I write
if(num!=NA)
it yields an error message.
However, if I write
if(is.na(num)==FALSE)
it works.
Why doesn't the first statement work?
Thanks,
Miao
[[alternative HTML version deleted]]
__
R-help@r-project.org ma
15 matches
Mail list logo