Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

all_pairs

Create all possible pairs


Description

Create all possible pairs of two character vectors.

Usage

all_pairs(x, y = character(0), sort = FALSE, result = "matrix")

names2pairs(x, y = NULL, sort = TRUE, result = "list")

Arguments

x, y

Character vectors.

sort

Logical.

result

A list or a matrix.

Details

NOTICE: If y is not NULL then x and y must be disjoint (no checks are made); otherwise pairs of identical elements wil also be obtained.

Author(s)

Søren Højsgaard, sorenh@math.aau.dk

Examples

x <- letters[1:4]
y <- letters[5:7]

all_pairs(x)
all_pairs(x, result="matrix")

all_pairs(x, y)
all_pairs(x, y, result="matrix")

gRbase

A Package for Graphical Modelling in R

v1.8-6.7
GPL (>= 2)
Authors
Søren Højsgaard <sorenh@math.aau.dk>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.