[R] evaluate NA to FALSE instead of NA?

2014-10-14 Thread Rainer M Krug
Hi I want to evaluate NA and NaN to FALSE (for indexing) so I would like to have the result as indicated here: , | p - c(1:10/100, NA, NaN) | p | [1] 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 NA NaN | p[p=0.05] | [1] 0.01 0.02 0.03 0.04 0.05 NA NA | p[sapply(p=0.05,

Re: [R] evaluate NA to FALSE instead of NA?

2014-10-14 Thread Sven E. Templer
use: which(p=.05) this will not yield logical, but integer indices without NA On 14 October 2014 11:51, Rainer M Krug rai...@krugs.de wrote: Hi I want to evaluate NA and NaN to FALSE (for indexing) so I would like to have the result as indicated here: , | p - c(1:10/100, NA, NaN) |

Re: [R] evaluate NA to FALSE instead of NA?

2014-10-14 Thread Pascal Oettli
Hi Rainer, As complete.cases() does? p - c(1:10/100, NA, NaN) complete.cases(p) [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE FALSE Regards, Pascal On Tue, Oct 14, 2014 at 6:51 PM, Rainer M Krug rai...@krugs.de wrote: Hi I want to evaluate NA and NaN to FALSE (for

Re: [R] evaluate NA to FALSE instead of NA?

2014-10-14 Thread Joshua Wiley
Hi, Perhaps still not as short as you want, but I normally use which(): p - c(1:10/100, NA, NaN) p[which(p = .05)] [1] 0.01 0.02 0.03 0.04 0.05 Cheers, Josh On Tue, Oct 14, 2014 at 8:51 PM, Rainer M Krug rai...@krugs.de wrote: Hi I want to evaluate NA and NaN to FALSE (for indexing) so