pair.matrix
From cape v2.0.2
by Anna L Tyler
Given a vector of elements, create a twocolumn matrix listing all pairs of elements
This function takes in a vector and returns a matrix of all pairs of the elements. The order of pairs can be ignored or taken into account, and selfpairs can either be included or ignored.
 Keywords
 internal
Usage
pair.matrix(elements, ordered = FALSE, self.pairs = FALSE)
Arguments
 elements
 A vector of elements for which all pairs are wanted. This vector can include numeric values, strings, or a mixture of both.
 ordered
 A logical value indicating whether order of pairs is important. TRUE indicates that pair 'ab' is different from 'ba'. A value of FALSE will return only one of these pairs.
 self.pairs
 A logical value indicating whether elements should be paired with themselves ('aa'). A value of TRUE will return a matrix including self pairs.
Value

A twocolumn matrix of all pairwise combinations of the vector elements is returned.
Examples
el < letters[1:4]
letter.pairs < pair.matrix(el, ordered = FALSE, self.pairs = FALSE)
print(letter.pairs)
el < 1:4
num.pairs < pair.matrix(el, ordered = FALSE, self.pairs = TRUE)
print(num.pairs)
Community examples
Looks like there are no examples yet.