'how to get in R a list or dataframe with the id of the node and its degree
I built a network from a matrix, calculate the degree with degree_gen<-degree(g, mode="all") and when I obtain and save it as an excel I have a column with only the degree and I have not been able to create a dataframe that has the id of the node in a column and in the second column the degree
Solution 1:[1]
I think you can try
stack(degree_gen)
to produce a dataframe with both node ID and degree
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ThomasIsCoding |
