[R] NA preserved in logical call - I don't understand this behavior because NA is not equal to 0

2010-07-18 Thread stephen sefick
I am confused by the behavior of the below piece of code. The NAs are making it past the logical call ==0. I am sure that I am missing something. I just don't understand this behavior. Thanks for your help in advance. code### left -

Re: [R] NA preserved in logical call - I don't understand this behavior because NA is not equal to 0

2010-07-18 Thread Uwe Ligges
On 18.07.2010 18:02, stephen sefick wrote: I am confused by the behavior of the below piece of code. The NAs are making it past the logical call ==0. I am sure that I am missing something. I just don't understand this behavior. Thanks for your help in advance.

Re: [R] NA preserved in logical call - I don't understand this behavior because NA is not equal to 0

2010-07-18 Thread David Winsemius
On Jul 18, 2010, at 12:02 PM, stephen sefick wrote: I am confused by the behavior of the below piece of code. The NAs are making it past the logical call ==0. I am sure that I am missing something. I just don't understand this behavior. Thanks for your help in advance.

Re: [R] NA preserved in logical call - I don't understand this behavior because NA is not equal to 0

2010-07-18 Thread Hadley Wickham
The problem is in data.frame[ and any NA in a logical vector will return a row of NA's. This can be avoid by wrapping which() around the logical vector which seems entirely wasteful or using subset(). The basic philosophy that causes this behaviour is sensible in my opinion: missing values

Re: [R] NA preserved in logical call - I don't understand this behavior because NA is not equal to 0

2010-07-18 Thread David Winsemius
On Jul 18, 2010, at 2:52 PM, Hadley Wickham wrote: The problem is in data.frame[ and any NA in a logical vector will return a row of NA's. This can be avoid by wrapping which() around the logical vector which seems entirely wasteful or using subset(). The basic philosophy that causes