Hello,

Can someone help me with this?

I am trying to find the start and end positions in a vector where numbers less 
than x is surrounded by number(s) greater than x.
 For example:
 try = c(7,223,42,55,30,25,61,5,70)
 x=40

 The desired output would be:

> loc
    start end
1     5      6
2     8       8

So the numbers I am interested in finding is: 30, 25 and the start= 5 and end = 
6
Also, 5 with the start=8 and end = 8
  
Thank you in advance for your help.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to