Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Finding the number that is reapeated consecutively the most in a vector

$
0
0

I have the following vector:

essaie <- "23690,55050,127789,64253,130127,63093,63093,63093,108374,63093,63093"
essaie_z <- c(as.numeric(unlist(strsplit(essaie, ","))))

I want to know which number repeats itself consecutively the most and how many time it does. Basically, I want to know:

Number that repeats itself consecutively the most: 63093 How many times: 3

How can I do that in r?

thanks,


Viewing all articles
Browse latest Browse all 201839

Trending Articles