Displaying 1 result from an estimated 1 matches for "true4sur".
Did you mean:
true4sure
2003 Jul 11
3
Indexing with NA as FALSE??
Hi Folks,
Example:
t<-c(1,2,3,4,5,6,7,8,9)
u<-c(1,NA,3,NA,5,NA,7,NA,9)
t[u==5]
--> NA NA 5 NA NA
Now, if I could somehow set things so that "NA" was FALSE for
indexing, then
t[u==5]
--> 5
I know I can do it with
t[(u==5)&(!is.na(u))]
but in the situation I am dealing with this leads to massively
cumbersome, typo-prone and hard-to-read code.
Also, as an extra, it would