I am stuck in drawing a graph on R. In particular, I would like to make a network graph as this
but with the central node of another color and the size of the other nodes as big as the column weights in the dataset. The dataset is the following:
structure(list(owner = c("MASTERS", "MASTERS", "MASTERS", "MASTERS", "MASTERS", "MASTERS","MASTERS", "MASTERS"),
armed_band = c("Biakatu Communal Militia", "FPJC", "FRPI", "LRA", "Mayi Mayi Militia", "Mayi Mayi Militia (Safisha Mabaya)", "Mayi Mayi Militia (Simba)", "RCD"),
weigth = c(1, 1, 1, 5, 2, 1, 1, 1)),
row.names = c(NA, -8L),
class = c("tbl_df", "tbl", "data.frame"))
The code I am using at the moment is the following:
aux_samearea_network <- read_excel("file")
concessions_network = network(aux_samearea_network,
matrix.type = "edgelist",
ignore.eval = FALSE,
names.eval = "weights" )
concessions_network %v% "Concession" = ifelse(
aux_samearea_network$armed_band %in% c("LRA",
"Mayi Mayi Militia",
"Biakatu Communal Militia",
"FPJC",
"FRPI",
"Mayi Mayi Militia (Safisha Mabaya)",
"Mayi Mayi Militia (Simba)",
"RCD"), "Armed Band", "Concession")
ggnet2(concessions_network,
node.size = "weights",
node.color = "lightblue",
edge.size = 1,
edge.color = "grey",
main = "Network concession MASTERS",
edge.label = "weights",
label = TRUE,)
Can anyone help me with this please? I would be extremely grateful.
I guess you can try
igraph
like belowand we will get