thanks, can I ask another basic question? I have a matrix (10000 X 6). 10000 rows and 6 columns. I want to remove rows that have sd(col1, col2,col3) <1 or sd(col4,col5,col6) <1. what is the simple way? Yu Duncan Murdoch <[EMAIL PROTECTED]> wrote: On 16/04/2008 7:33 PM, Yuan Jian wrote: > Hello, > I have a matrix, I want to change value to 0 when a element in the matrix has > less than 10. > do you know how to do it without using loops?
A[A < 10] <- 0 Remember that matrices are just vectors with dimensions, so you can index one like a vector. Duncan Murdoch --------------------------------- [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel