Unfortunately - no luck. Changing to the ifelse construction didn't fix the problem, and changing the "" to a zero or a NA also didn't help.
Meanwhile, I have 4 other sd calculations on the same dataset, using the same construction, elsewhere in the document and code. None of them are giving me any problems whatsoever. I think it because you are trying to use the if-else control construct, when you should be using the ifelse function: ?ifelse Try (perhaps): traindev <- ifelse( (trainlength>0), round(sd(trainscores, na.rm=T), 1) , "") You do seem to be mixing types, though, so perhaps you should use NA instead of "". -- David Winsemius -- View this message in context: http://www.nabble.com/Baffled%3A-triggering-error-message-with-an-sd-result-in-odfWeave--tp21016679p21017853.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.