powered by
GetGroupFactor will split a numeric vector according to a specified gap value. This is often a useful tool and therefore exported to the namespace.
GetGroupFactor
GetGroupFactor(x, gap)
A factor vector of length(x) indicating the different groups in x.
Numeric vector.
Difference between two consecutive values at which a split is generated.
x <- c(1:3,14:12,6:9) GetGroupFactor(x=x, gap=2) split(x, GetGroupFactor(x=x, gap=2))
Run the code above in your browser using DataLab