[R] conditional replacement of contiguous values

andrewjt atrant at mun.ca
Fri Oct 8 19:07:58 CEST 2010


Hello,
I need help getting from data$HAVE to data$NEED (see below). This requires
replacing every TRUE in data$HAVE with 4 TRUE(s) in data$NEED. 

Any ideas? It seems straight forward but I can't figure it out!
Thanks in advance


  HAVE             NEED

1  FALSE          FALSE
2  FALSE          FALSE
3  TRUE           TRUE
4  FALSE          TRUE
5  FALSE          TRUE
6  FALSE          TRUE
7  FALSE          FALSE
8  FALSE          FALSE
9  FALSE          FALSE
10 TRUE          TRUE
11 FALSE         TRUE
12 FALSE         TRUE 
13 FALSE         TRUE
-- 
View this message in context: http://r.789695.n4.nabble.com/conditional-replacement-of-contiguous-values-tp2968727p2968727.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list