Thank you for the quick response :-). I've applied your suggestion to my code, but I still receive an error:
> CEM1_PARTIAL$V3[which(CEM1_PARTIAL$V4 == "DOWN") - 1] <- > CEM1_PARTIAL$V3[which(CEM1_PARTIAL$V4 == "DOWN") - 1] * -1 Warning message: In Ops.factor(CEM1_PARTIAL$V3[which(CEM1_PARTIAL$V4 == "DOWN") - : * not meaningful for factors I would like to perform this evaluation in a loop b/c my data matrix actually contains 109 columns, and 32,000 rows. More suggestions are appreciated! Thanks! -- View this message in context: http://r.789695.n4.nabble.com/matrix-looping-accessing-previous-column-tp3165308p3165325.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.