search for: rowstochange

Displaying 1 result from an estimated 1 matches for "rowstochange".

2003 Feb 09
0
to modify a matrix : Summary
...;- x[,2]*(1+4*(x[,1]==3)) good result, a little bit tricky. (2) x[,2] <- ifelse(x[,1]==3, x[,2]*5, x[,2]) good result, easy to be understood. (3) for(i in 1:5) {if (x[,1]==3) {x[,2] <- 5*x[,2]}} unable to get any modification, theoretically easily undrstandable from a programmer. (4) rowstochange <- x[,1]==3 x[rowstochange,2] <- x[rowstochange,2]*5 good result, to give many suggetions. When I excute "rowstochange <- x[,1]==3", I have > rowstochange [1] FALSE FALSE TRUE FALSE FALSE . This is my first time to realize the meaning of the expression of "x[,1]...