I am interested to generate all the possible combinations of a vector, for example,
v1 <- c("A", "Aa", "B")
and all the possible combinations will be
"A-Aa" "Aa-A" "B-A" "B-Aa" "A-B" "Aa-B"
I saw a post- How can I generate all the possible combinations of a vector, but it does not give correct results for v1
. The same thing happens to v1 <- c("Testis_NOA_ID","Testis_NOA_IDSt")
which returns "Testis_NOA_ID-Testis_NOA_IDSt"
only but I am expecting "Testis_NOA_IDSt-Testis_NOA_ID"
also.
I checked some other vectors such as v1 <- c("a,"b","c)
or v1 <- c("normal", "cancer")
, which it gives correct results. The problem comes when the vector content is repeating like v1 <- c("Testis_NOA_ID","Testis_NOA_IDSt")
. How to fix it.