Learn R Programming

BALCONY (version 0.2.10)

find_consecutive_seq: Find sequences of numbers in a numeric vector

Description

This function finds sequences of consecutive numbers in numeric vectors

Usage

find_consecutive_seq(vector)

Arguments

vector

A numeric vector to be analyzed

Value

values

A vector of values starting the consecutive sequences

lengths

A vector of lengths of identified sequences

Details

Out of the following vector: 1,2,3,4,5,6,7,20,21,140,141 the function will find values starting the sequences: 1,20,140 and their lengths 7,2,2 respectively

Examples

Run this code
# NOT RUN {
find_consecutive_seq(c(1,2,3,4,5,6,7,20,21,140,141,300,301,302))
# }

Run the code above in your browser using DataLab