On Nov 26, 2014, at 1:27 AM, Frederic Ntirenganya <ntfr...@gmail.com> wrote:
> The error seems to be starnge to me because i access the indices of NAs. No you don't. You access the contents of the cell via an index for which you have previously determined that the contents is NA. Then you compare that contents with 60. The error is in the logic of these steps: >> indicNAs <- which(data$Rain %in% NA) # indices for NA >> for (i_NA in indicNAs ){ # i_NA is one of these indices >> if(data$Rain[i_NA] == 60){ # data$Rain[i_NA] contains ... NA ! >> Never 60. HTH, B. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.