Split vector at unknown index

后端 未结 1 528
無奈伤痛
無奈伤痛 2021-01-18 20:14

I have a vector in R which contains at least 50.000 reals. The values are ordered from small to large and now I need to split up this vector in different vectors. The vector

相关标签:
1条回答
  • 2021-01-18 21:10

    Try this,

    split(data, cumsum(c(0, diff(data)>=2)))
    
    0 讨论(0)
提交回复
热议问题