I am a basic programmer using R for social-network analysis and have some information that I am not sure how to solve.
WHAT I HAVE:
- An adjacency matrix stored as a csv file with the following information: a) Households in row 1 and households in column 1 interact with each other through sharing resources. b) The interactions are ties represented by kinship numbers. The smaller the number the closer (or stronger) the kinship connection. For example, 1 is parent-child kinship, and 100 is no kinship. No kinship to self is NA. c) File snippet:
[,1] [,2] [,3] [,4] [,5] [1,] NA 100 2 1 100 [2,] 4 NA 100 100 3 [3,] 100 3 NA 2 4 [4,] 100 1 5 NA 100 [5,] 1 100 4 100 NA
WHAT I NEED:
I need to convert this adjacency matrix into an edge list with three columns ("HH1", "HH2", "HHKinRank") in order to complete additional kinship calculations.
This edge list must be saved as a new csv file for further analysis.
My greatest issue with the list, is that it will need to only list the numerical values. If there is no tie (NA) then will the edge list show this?
WHAT I HAVE DONE:
I tried assigning the csv file to a new variable HHKinRank.el <- read.csv("HouseholdKinRank.csv").
When I did this the most frustrating component was determining what libraries I may have to use. There are many function commands, such as melt, so troubleshooting is an issue because I also may be incorrectly assigning values.
I can go from an edge list to a matrix, but the opposite is hard to run the commands for.
Thank you for any assistance with this.