Generates a two-column matrix consisting of consecutive pairs from the input vector. This function in useful for functions that need to be applied to consecutive elements in a vector.
A vector of elements for which consecutive pairs are desired. Elements can be of any class.
A two-column matrix is returned. Each row of the matrix consists of two consecutive elements of the input vector. All consecutive pairs are included.
1 2 3
V <- 1:5 consec.pairs(V) V
Warning messages: 1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display 2: 'rgl_init' failed, running with rgl.useNULL = TRUE 3: .onUnload failed in unloadNamespace() for 'rgl', details: call: fun(...) error: object 'rgl_quit' not found [,1] [,2] [1,] 1 2 [2,] 2 3 [3,] 3 4 [4,] 4 5  1 2 3 4 5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.