search for: tp22173710p22175864

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

2009 Feb 23
2
array manipulation simple questions
  Hi there,   I am pretty new to R. Actually I started using it yesterday. I have two questions:   1.   Suppose I have a<-c(1:10)  (or a<-array(c(1:10),dim=c(1,10)))   and I want to end up with vector b=[0 0 0 0 0 1 1 1 1 1]. i.e. I want to substitute alla elements that are <5 with 0 and >5 with 1.   I did this by using a for loop. Is there another function to use so as to avoid the