pair_matrix: Get all pairs of elements in a vector

View source: R/pair_matrix.R

pair_matrixR Documentation

Get all pairs of elements in a vector

Description

This function makes a matrix with two columns listing all pairwise combinations of the elements of the input vector.

Usage

pair_matrix(elements, ordered = FALSE, self_pairs = FALSE)

Arguments

elements

a vector containing elements from which to draw all possible pairs. Can be numeric or strings

ordered

A logical value indicating whether the order of the pairs is important. If TRUE both a,b and b,a will be returned. If FALSE, only a,b will be returned.

self_pairs

A logical value indicating whether self pairs should be included. If TRUE, a,a will be returned. Otherwise it will be excluded.

Value

A two-column matrix containing pairs of entries in elements.


cape documentation built on May 29, 2024, 5:11 a.m.