Re: [R] expanding some values in logical vector

2004-03-15 Thread Petr Pikal
Thank you very much. I myself thought about something similar but I was not so smart to use outer. Cheers Petr On 15 Mar 2004 at 13:51, Peter Wolf wrote: > Try: > > > x<-rep(FALSE,20); x[c(4,10,15)]<-TRUE > > x > [1] FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE > FALS

Re: [R] expanding some values in logical vector

2004-03-15 Thread Peter Wolf
Try: > x<-rep(FALSE,20); x[c(4,10,15)]<-TRUE > x [1] FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE [13] FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE > x[outer(which(x),-1:1,"+")]<-T > x [1] FALSE FALSE TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE TRUE FALSE [13] FA

[R] expanding some values in logical vector

2004-03-15 Thread Petr Pikal
Dear all In automatic dropout evaluation function I construct an index (pointer), which will be TRUE at "unusual" values. Then I need to expand these TRUE values a little bit forward and backward. Example: having span=5, from vector idx<-rep(F,10) idx[4]<-T > idx [1] FALSE FALSE FALSE TRUE