pair_matrix: Get all pairs of elements in a vector

Description Usage Arguments Value

View source: R/pair_matrix.R

Description

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

Usage

1
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 Feb. 10, 2021, 5:06 p.m.