[R] inequality with NA

Mag. Ferri Leberl ferri.leberl at gmx.at
Fri Sep 22 20:16:57 CEST 2006


Dear everybody!
take a<-c(5,3,NA,6).

if(a[1]!=NA){b<-7}
if(a[3]!=5){b<-7}
if(a[3]!=NA){b<-7}
if(a[3]==NA){b<-7}

will alltogeather return

Fehler in if (a[1] != NA) { : Fehlender Wert, wo TRUE/FALSE nötig ist

(or simularly). Somehow this is logical. But how else should I get out,
whether a certain vector-component has an existing value?
Thank you in advance!
Yours,
Mag. Ferri Leberl



More information about the R-help mailing list