I have data that follows a similar format to
.
The goal is to create an adjacency matrix that demonstrates the relationships between the different names. If two names are related, 1 is inputed into the corresponding cell in the adjacency matrix. If not, 0 is inputed. Two names are related if both names have the same fruit. For instance, since Jake has Apple and Carly has Apple, they are both related. Here is a sample adjacency matrix based on the sample data provided.
.
What is the most efficient method of doing this in R programming when I have over 600,000 rows of data? Any suggestions?