Suppose I have the following data:
p1 <- c('a','a','a','a','a','b','b','b','b','c','c')
p2 <- c('b','c','d','e','f','c','a','e','d','e','f')
connections <- data.frame(p1, p2)
Where p1
and p2
are persons and each row represents a connection.
Question: How do I write a function that finds the maximum # of common connections between 2 people? (E.g. a & b have 3 common connections: c, d, e)