Can I add edges with arrows that begin from nodes 4 5 6 7 and lead to nothing? Just 4 straight lines.
library(visNetwork)
# Create nodes data frame
nodes <- data.frame(
id = 1:7,
label = c("BLADDER", "TRODELVY", "EV", "NO ADC RECEIVED", "EV", "NO ADC RECEIVED", "TRODELVY "),
color = c("gray", "red", "blue", "gray", "blue", "gray", "red"),
shape = "box",
level = c(1, 2, 2, 3, 3, 3, 3)
)
# Create edges data frame
edges <- data.frame(
from = c(1, 1, 2, 2, 3, 3),
to = c(2, 3, 4, 5, 6, 7)
)
# Create the network visualization
visNetwork(nodes, edges) %>%
visNodes(shape = "square", size = 500, font = list(color = "white")) %>%
visOptions(highlightNearest = TRUE, nodesIdSelection = TRUE)%>%
visHierarchicalLayout(levelSeparation = 200, direction = "LR")