On Wed, Mar 21, 2012 at 12:48 PM, HJ YAN wrote:
> Thanks a lot Sarah, for your nice example and code.
>
> I know '==' can do the work. Just as a R beginer, sometimes really want to
> be more like a 'real programmer', if you know what I mean...
Being a "real programmer" means using one line of co
As long as == is an appropriate test for your data, why not just use
R's innate ability to handle matrices/data frames?
> x1 <- matrix(1:20, ncol=4)
> x2 <- ifelse(x1 > 18, 22, x1)
> x1
[,1] [,2] [,3] [,4]
[1,]16 11 16
[2,]27 12 17
[3,]38 13 18
[4,]4
2 matches
Mail list logo