[R] ifelse, evaluating to given number

From: Peter Wilkinson <pwilkinson_at_videotron.ca>
Date: Mon 19 Jul 2004 - 09:08:16 EST

I would like to take advantage of the vectorized 'ifelse' command. Given a filter number of 'filter', if the nm'th value in a n x m matrix I would like to perform the following.

newMatrix <- ifelse(myMat <=filter, filter+1, "existing nm'th value").

What do I use to express the "existing nm'th value" in this expression if I want to test an nm th value is less than 'filter', if false use the existing nm'th value.

This does not seem to be documented in the help().

Peter W.



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jul 19 09:17:51 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 02:36:42 EST