Closed shainova closed 4 years ago
The corrected function should be:
create_infomap_linklist <-
function (x, make_directed = F, write_to_file = F, output_file = "infomap_link_list.txt") {
if (class(x) != "monolayer") {
stop("x must be of class monolayer")
}
edge_list <- x$edge_list
names(edge_list)[1:2] <- c('from','to')
nodes <- x$nodes
edge_list %<>% left_join(nodes, by = c(from = "node_name")) %>%
left_join(nodes, by = c(to = "node_name")) %>% select(from = node_id.x,
to = node_id.y, weight)
if (write_to_file) {
print(paste("Link list written to: ", output_file, sep = ""))
write_delim(edge_list, output_file, delim = " ", col_names = F)
}
out <- list(edge_list_infomap = edge_list, nodes = nodes)
class(out) <- "infomap_link_list"
return(out)
}
fixed
Need to add the line
names(edge_list)[1:2] <- c('from','to')
to be able to join the edge list in the next command