It depends how you stored your missing values. If they are listed as NAs then
mydataframe$calib <- Count - is.na(stain)*Count or mydataframe$calib <- Count*(1 - is.na(stain)) The trick is the boolean 'TRUE' equals 1 in numeric calculations. -- View this message in context: http://n4.nabble.com/Vertical-subtraction-in-dataframes-tp1591223p1591351.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.