I have a dataframe such as ;
Comparison Distance
A,B 2
A,C 30
A,D 32
A,E 34
B,C 31
B,D 40
B,E 5
C,E 2
C,D 6
D,E 7
and I have two list such as ;
Group_1 <- c("A","B")
Group_2 <- c("C","D","E")
and I would like to generate three new lists where I put all the Comparison between the element in Group_1 and Group_2 in a List1_G1vsG2, one List2_G1vsG1 with comparison within element of Group_1 and on in List3_G2vsG2 for comparison within elements of Group_1.
I shoul then get the following lists:
List1_G1vsG2
c(30,32,34,31,40)
List2_G1vsG1
c(2)
List3_G2vsG2
c(5,2,6,7)
Here is the dataframe in dput() format if it can help
structure(list(Comparison = c("A,B", "A,C", "A,D", "A,E", "B,C",
"B,D", "B,E", "C,E", "C,D", "D,E"), Distance = c(2, 30, 32, 34,
31, 40, 5, 2, 6, 7)), class = "data.frame", row.names = c(NA,
-10L))