Makes an edge list from row data.
make_edgelist(names = NULL, attribute = NULL)
A data frame with N columns where the first one has the survey respondents (edge origin), and the other columns express the destination of the edge
A data frame with the same dimensions as the data frame in names, where each column has the corresponding attribute for the structure in the names data frame.
a data frame with the edge list and one edge attribute
This function processes row network data producing a list of edges. The function returns a data frame. If only the argument `names` is specified, the function returns a data frame with two columns, indicating the node from which the link comes from in column one (respondents) and the node to which the link is directed in column two (alters).
If the argument `attribute` is also specified, the function returns a data frame with three columns. The first two columns are the same as above, the third column contain information about one edge attribute
It is not possible to process more than one attribute at the time. If needed, it is possible to use the function with different attributes and then merge the output data frame using `cbind()`.
The function takes only data frames as input and the first column in the input data frame needs to express the nodes originating the edges.
The user should provide the values of respondent-alter relationships and edge attributes in the same order.
if (FALSE) { # \dontrun{
namedf <- data.frame(respondent = c('A', 'B', 'C'),
alter1 = c('D', 'C', 'A'),
alter2 = c('B', 'A', 'A') )
attributedf <- data.frame(attributeCol1 = 1:3, attributeCol2 = 4:6)
edgelist <- make_edgelist(names = namedf, attribute = attributedf)
} # }