[R] matrix looping accessing previous column

R_novice kasojim at battelle.org
Mon Dec 27 19:28:17 CET 2010


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.



More information about the R-help mailing list