Description Usage Arguments Value Examples
View source: R/group-consecutive.R
Could be either increasing or decreasing sequences. The order in the vector matters. There's no ordering done during the computation.
The missing values aren't handled gracefully. Be careful if the input data has any missing values.
1 | group_consecutive(x, .early_exit = TRUE)
|
x |
a numeric vector with a length of one. |
.early_exit |
exits function early if there're no consecutive numbers.
This argument is mainly for benchmarking purposes. Default value is |
A list with a number of groups. The vectors in the list elements are the vector indices, not values.
1 2 3 4 5 | x <- c(16, 17, 18, 19, 100, 99, 98)
group_consecutive(x)
## missing one in the middle:
y <- c(seq(1, 3), seq(5, 8))
group_consecutive(y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.