 
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 "for"?
 
 
2.  Suppose I have a<-c(1,1,2,2,3,3)  (or array again)
 
And I want to place a "4,5" before every "2" and end up with a new "bigger" vector "b":
 
b=[1 1 4 5 2 4 5 2 3 3]
 
Also I want to find where the 2's in array "a" (if it was an array) are located i.e. positions 3,4.
 
 
Thanx very much in advance!!
 
P.S: Will you inform me via mail or should I visit any blog and post there my questions?
 
 


      
___________________________________________________________ 
Χρησιμοποιείτε Yahoo!; 
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail 
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών 
μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr

	[[alternative HTML version deleted]]


