小编use*_*964的帖子

How to count a repeating repeating part of a sequence in R?

Is it possible to count a repeating part of a sequence in R? For example:

x<- c(1,3.0,3.1,3.2,1,1,2,3.0,3.1,3.2,4,4,5,6,5,3.0,3.1,3.2,
      3.1,2,1,4,6,4.0,4,3.0,3.1,3.2,5,3.2,3.0,4)
Run Code Online (Sandbox Code Playgroud)

Is it possible to count the times that the subsequence 3.0,3.1,3.2 occurs? So in this example it must be: 4

r count sequence repeat

4
推荐指数
1
解决办法
1173
查看次数

标签 统计

count ×1

r ×1

repeat ×1

sequence ×1