Hello,
I am struggling with detecting successive digits in a numerical series
vector.
Here is an example:
vec - c(1, 15, 26, 29, 30, 31, 37, 40, 41)
I want to be able to detect 29, 30, 31 and 40, 41.
Then, I would like to delete the successive digits from the vector.
1, 15, 26, 29, 37, 40
On Feb 11, 2012, at 10:01 AM, syrvn wrote:
Hello,
I am struggling with detecting successive digits in a numerical series
vector.
Here is an example:
vec - c(1, 15, 26, 29, 30, 31, 37, 40, 41)
I want to be able to detect 29, 30, 31 and 40, 41.
Then, I would like to delete the successive
That's great code. Thanks a lot!
--
View this message in context:
http://r.789695.n4.nabble.com/Detect-numerical-series-tp4379088p4379133.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
This was actually answered a couple times in StackOverflow. Someone and
I indpendently wrote up the following function, stolen directly from the
source for rle().
# extended version of rle to find all sorts of sequences
# if incr=0, this is rle
seqle- function (x,incr=1)
{
if
4 matches
Mail list logo