Skip to content
Back to formatted view

Raw Message

Message-ID: <CY1PR19MB01565074D971D77D7CCBEA96CB2A0@CY1PR19MB0156.namprd19.prod.outlook.com>
Date: 2016-06-20T18:58:08Z
From: C Lin
Subject: patterns in numeric vector

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.