[R] Error Missing values where true/false needed
Frederic Ntirenganya
ntfredo at gmail.com
Tue Nov 25 13:19:53 CET 2014
Dear All,
I am getting this error and don't know why it comes. can you please help ?
Error in if (data$Rain[i_NA] == 60) { :
missing value where TRUE/FALSE needed
The loop is :
indicNAs <- which(data$Rain %in% NA)
ind_nonleap = c() # NAs due to non leap years
ind_nonrecord = c() # NAs due to non recording values
for (i_NA in indicNAs ){
if(data$Rain[i_NA] == 60){
ind_nonleap <- append(ind_nonleap,i_NA)
}
else {
ind_nonrecord<-append(ind_nonrecord,i_NA)
}
#cat(ind_nonrecord)
#cat( ind_nonleap)
}
ind_nonleap
Regards,
Frederic.
Frederic Ntirenganya
Maseno University,
African Maths Initiative,
Kenya.
Mobile:(+254)718492836
Email: fredo at aims.ac.za
https://sites.google.com/a/aims.ac.za/fredo/
[[alternative HTML version deleted]]
More information about the R-help
mailing list