I'm trying and failing to get the number of elements in the intersect between several vectors at once in R: I have several character vectors of different lengths (unique elements) and want to get the number of elements shared between each pair of vectors.
Essentially, this means something like length(intersect(a,b))
, but repeated several times/as a cross-tabulation over all combinations of vectors.
I feel like this is a simple case involving something like the apply()
family, but I can't seem to figure this out... :-/
Thank you for any advice!