This function returns a matrix of all pairs of values in a vector.
Usage
get_all_pairs(vec, direction = c("direct", "double", "reverse"))Arguments
- vec
Vector
- direction
direct(default) Like permutation: (a,b) and (b,a) are treated as the same pair and only one is returneddoubleLike combination: (a,b) and (b,a) are treated as distinct pairsreverseLike direct, but the two columns are reversed
Examples
get_all_pairs(c("x1", "x2", "y1", "y2"))
#> [,1] [,2]
#> 4 "x1" "x2"
#> 6 "x1" "y1"
#> 7 "x2" "y1"
#> 10 "x1" "y2"
#> 11 "x2" "y2"
#> 13 "y1" "y2"