I have been searching for an answer online but cannot seem to to get anywhere close..
I have a set of tickers and used expand.grid()
to find combinations of them:
# TICKERS
A <- c("AIR", "AFAP", "AAL", "CECE", "ASA", "AVX")
# FIND COMBINATIONS
B <- expand.grid(A,A,stringsAsFactors=FALSE)
So now I want to omit the reciprocals, for example:
row 2 and row 7 are reciprocals, and I just want to keep one of those combinations not both.
head(B,10)
Var1 Var2
1 AIR AIR
2 AFAP AIR
3 AAL AIR
4 CECE AIR
5 ASA AIR
6 AVX AIR
7 AIR AFAP
8 AFAP AFAP
9 AAL AFAP
10 CECE AFAP