The simplest way to generate such combinations would be to use combn function as follows:
print(combn(letters[1:3],2))
The output that it generates is:
[,1] [,2] [,3]
[1,] "a" "a" "b"
[2,] "b" "c" "c"
This doesn't generate combinations like aa, bb (same character repeated).
This even doesn't generate ba if ab is generated.
I want to generate all such combinations of length 2 for a vector [a,b,c].
Is there a simple way to do so in R?