Learn R Programming

cape (version 3.1.2)

consec_pairs: Generate a matrix of consecutive elements

Description

Given a vector, this function generates a two-column matrix in which each row contains an element and its consecutive neighbor.

Usage

consec_pairs(elements)

Value

a matrix with two columns. The first column is identical to elements with the last element taken off. And second column holds the next consecutive element.

Arguments

elements

a vector of elements