How to create an adjacency matrix from raw data which is non-numeric in nature [duplicate]
问题 This question already has answers here : How to calculate adjacency matrices in R (2 answers) Closed 6 years ago . An example of the input I am working on is given below: User ID 1 --- Artist 5 User ID 2 --- Artist 1 User ID 3 --- Artist 7 User ID 4 --- Artist 2 User ID 5 --- Artist 3 User ID 1 --- Artist 2 User ID 3 --- Artist 1 The above data is a record of music listened to by users of an app. I would like to generate an adjacency matrix corresponding to the below given example: ARTIST 1