combinadic: i-th combination of n elements taken from r

View source: R/auxiliar.R

combinadicR Documentation

i-th combination of n elements taken from r

Description

Function similar to combn but for larger vectors. To avoid allocating a big vector with all the combinations each one can be computed with this function.

Usage

combinadic(n, r, i)

Arguments

n

Elements to extract the combination from

r

Number of elements per combination

i

ith combination

Value

The combination ith of the elements

Author(s)

Joshua Ulrich

References

StackOverflow answer 4494469/2886003

See Also

combn()

Examples

# Output of all combinations
combn(LETTERS[1:5], 2)
# Otuput of the second combination
combinadic(LETTERS[1:5], 2, 2)

llrs/BioCor documentation built on March 9, 2024, 7:49 a.m.