search for: edu1

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

Did you mean: edu
2010 Aug 03
3
how to do a IF ELSE in a matrix format
...rs I am new to R and this question may has been asked many times or a very old one.?I have checked the archive but found nothing (maybe I used?the wrong key words).?any advise is appreciated the question is: I try to replace a col vector with some other values, see edu<-matrix(0,1000,2) edu1<-runif(1000,0,1) edu[,1]<-edu1 the colum ?vector?edu[,1]? would?have value between 0 and 1. if I want to replace the value of edu[,2] to 1 if edu[,1] less than 0.5, how to do it in the form of matrix but not?under a?loop structure? I have tried: if (edu[,1]>=0.5) edu[,2]=1 there i...