[R] replace values in a matrix subject to boolean condition

From: Werner Wernersen <pensterfuzzer_at_yahoo.de>
Date: Thu 24 Mar 2005 - 01:14:49 EST


Hi everybody!

I am sorry to bother you with a question so simple but I think there might be a
better solution:
I have a matrix of size 360x501 where I want to check the value of each 5th
column of each row and replace it (and the 6th, 7th, 8th column) by zero if the
value is less than 1000. I have written a double loop
to do that but that
requires a lot of time.

Is there a faster way to achieve this?

Thanks,

   Werner



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Mar 24 01:24:23 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:55 EST