Split a numeric vector into continuous chunks in R
If I have a numeric vector [1 2 3 4 7 8 9 10 15 16 17], how can I split it
so that I have multiple vectors returned that separate the continuous
elements of that vector? I.e. [1 2 3 4] [7 8 9 10] [15 16 17]. I've found
an answer of how to do this in matlab, but I only use R.
Thanks.
No comments:
Post a Comment