Thanks a lot, it was very helpful, I did something like that:
EV <- ifelse(sprd > mediaSDP & sprd_d <= mediaSDP_d, -1, 0) SV <- ifelse(sprd > media & sprd_d <= media_d, -17, 0) EC <- ifelse(sprd < mediaSDN & sprd_d >= mediaSDN_d,1,0) SC <- ifelse(sprd < media & sprd_d >= media_d,17,0) in order to have 4 vectors and work with them. Happy new year and kind regards -- View this message in context: http://r.789695.n4.nabble.com/Loops-and-vector-operations-tp4240434p4246200.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.