RecordLinkage (version 0.4-11)

unorderedPairs: Create Unordered Pairs

Description

Creates all unordered pairs of some objects or of the first x natural numbers.

Usage

unorderedPairs(x)

Arguments

x

Either an arbitrary vector of literals or a natural number

Value

A matrix with two rows, each column holding one pair.

Details

If x has length one, all unordered pairs of the first x natural numbers are created. If x has more than one element, all unordered pairs of the elements of x are created.

Examples

Run this code
# NOT RUN {
  # create unordered pairs of {1,2,3}: {1,2},{1,3} and {2,3}
  unorderedPairs(3)
  # create unordered pairs of {"a","b","c"}: {"a","b"}, {"a","c"},{"b","c"}
  unorderedPairs(c("a","b","c"))
# }

Run the code above in your browser using DataLab