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

allCombs

Create all combinations of the elements of a vector.


Description

Creates a matrix with all combinations of 1 to all elements of the vector provided. Elements to occur in all combinations can be specified. This is internally called by brute.search.

Usage

allCombs(x, force = c(), trace = FALSE)

Arguments

x

A vector of elements of which combinations are to be formed.

force

A vector of elements that are supposed to occur in each combination.

trace

A boolean indicating if some output should be printed (TRUE) or not (FALSE=default).

Value

A matrix with one combination per row. For the shorter combinations, the columns to the right are filled up with NA.

Author(s)

Lutz P Breitling <l.breitling@posteo.de>

See Also

Examples

allCombs(1:4, force=3);

dagR

R Functions for Directed Acyclic Graphs

v1.2.0
GPL-2
Authors
Lutz P Breitling
Initial release
2021-04-17

We don't support your browser anymore

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