R: Create Unordered Pairs

unorderedPairs {RecordLinkage} | R Documentation

## 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

### 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.

### Value

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

### Author(s)

Andreas Borg

### Examples

      # 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"))

[Package RecordLinkage version 0.4-11.2 Index]