Return counts of matches and unique items for all pairwise comparisons within subsets
问题 I have a data frame of plant plantsp and herbivore lepsp species and their interactions int1 and int2 with sampling nested in site , season and group . I wish to create a loop that makes pairwise comparisons among each level of group collected within each site and season subset. Fore each pairwise comparison I will calculate total MATCHING and UNIQUE interactions among int1 and int2 . I have devised the following steps to break down this problem: Consider the following example data frame df :