s-news
[Top] [All Lists]

comparing NA values

To: s-news@lists.biostat.wustl.edu
Subject: comparing NA values
From: Dave Evens <devens8765@yahoo.com>
Date: Tue, 14 Jun 2005 03:24:43 -0700 (PDT)
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=2aUnjcz7mJznscf5xTmyexWe4yw68WeIiHiglOUkKgCoQ+Ta54PSzGH2jEeSaiDwA8kfy8D6Os0/kOfavLV+B42t+o9isqQJASwElYnWBV31pE5h1gfittwpWcj8IUFaMV0NwwJhteyXaxuGzn/2bZJSmdTNQWGBZt2fKEfPKVg= ;
Is it possible to make comparisons between numeric NAs
and other numeric values?

For example, if I have two vectors

> x<-c(1:10,1:10,rep(NA,20))
> y<-c(1:30,rep(NA,10))

I want to compare them

> x==y
 [1]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE 
TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE    NA    NA    NA    NA    NA
[26]    NA    NA    NA    NA    NA    NA    NA    NA  
 NA    NA    NA    NA    NA    NA    NA

What I would like is to have TRUE for the first 10,
FALSE for the next 20, and NA for the last 10. Is this
possible?

Thanks in advance for any help.

Dave



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

<Prev in Thread] Current Thread [Next in Thread>