Hello list members I have a problem with modifying a data.frame. As an example given is a data.frame called ex :
ex<-data.frame(id=c(1,2,3,4,5,6),obs=c(14,9,20,36,55,47),eff=c("A","A","B","C","C","C")) After that I would like to modify the object ex with the following short script: for (i in ex) { if(ex[i,3]=="A"|| ex[i,3]=="C"){ ex[i,4]<--9999 } else { ex[i,4]<-10 } } This script is creating an error message: Fehler in if (ex[i, 3] == "A" || ex[i, 3] == "C") { : Fehlender Wert, wo TRUE/FALSE nötig ist Why this script doesn't work properly? Thanks a lot for your hints Beat ______________________________________________ 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.