Hi all, probably something really simple, that I've missed but I'm running this loop in my Rscript:
<code> for (i in 1:nrow(cells)){ if(plate == as.character(cells[i,1])){ plate2 <-cells[i,2]} } <code> it's assigning the relevant data correctly as long as plate exists somewhere in cells[i,1]. The problem is that if it doesn't exist then it retains the previous value of plate2. I've tried setting it to a default value in a number of ways, but most have destroyed the data structure of plate2. Anybody know how I can give it a value where the if loop has failed without loosing the remainder of plate2? Many Thanks Richard [[alternative HTML version deleted]] ______________________________________________ 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.