Hi all
I have a data set with the total number of columns =ncol, and the total number of rows=nrow. I am trying to loop over the values and id the value is less than or equal to 100 to be changed to 1. if the value is greater than 100 , to be changed to 0. if NA , let X[i,j]=NA. I ran into a problem where if one row in my data set had all values =NA, then the program does not continue working past that row! At some point I get the following error message: “Error in if (data [i, j] <= 100) { : missing value where TRUE/FALSE needed” Here is the program data<-read.table("fileName.txt", header=F, sep='\t') X=data for(i in ncol) { for(j in nrow) { if(data[i,j]<=100) {X[i,j]=1} if(data[i,j]>100) {X[i,j]=0} if(is.na(data[i,j])) {X[i,j]=NA} } } Thanks -- View this message in context: http://www.nabble.com/prblem-with-NA-tp21301527p21301527.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.