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

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/auxiliar.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

1
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

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

Example output

If you use BioCor in published research, please cite:
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] "A"  "A"  "A"  "A"  "B"  "B"  "B"  "C"  "C"  "D"  
[2,] "B"  "C"  "D"  "E"  "C"  "D"  "E"  "D"  "E"  "E"  
[1] "C" "A"

BioCor documentation built on Nov. 8, 2020, 4:56 p.m.