Using which() improves my code, but now I'm receiving some data.frame error
and still does not convert the values to negative.
#TAKE PART OF MATRIX
CEM1_PARTIAL <- CEM1[1:10,1:10]
#CEM1_PARTIAL=apply(CEM1_PARTIAL,2,as.character)
#CEM1_PARTIAL <- as.numeric(as.character(CEM1_PARTIAL))
#CEM1_PARTIAL[which(CEM1_PARTIAL$V4 == "DOWN") - 1] <-
CEM1_PARTIAL$V3[which(CEM1_PARTIAL$V4 == "DOWN") - 1] * -1
for(j in 1:ncol(CEM1_PARTIAL))
{
for(i in 1:nrow(CEM1_PARTIAL))
{
CEM1_PARTIAL[which(CEM1_PARTIAL[i,j] == "DOWN")] =
CEM1_PARTIAL[which(CEM1_PARTIAL[i,j] == "DOWN")-1] * -1
}
}
Error in data.frame(value, row.names = rn, check.names = FALSE, check.rows =
FALSE) :
row names supplied are of the wrong length