visNetwork(nodes_df, edges_df) %>% visHierarchicalLayout(direction = "LR") %>%
visOptions(highlightNearest = TRUE, nodesIdSelection = TRUE) %>%
visInteraction(navigation = "zoom") %>%
visInteraction(navigation = "drag") %>% visOptions(selectedBy = c("names", "id"))
Warning message:
In if (!byselection$variable %in% colnames(graph$x$nodes)) { :
the condition has length > 1 and only the first element will be used
I also tried:
visNetwork(nodes_df, edges_df) %>% visHierarchicalLayout(direction = "LR") %>%
visOptions(highlightNearest = TRUE, nodesIdSelection = TRUE) %>%
visInteraction(navigation = "zoom") %>%
visInteraction(navigation = "drag") %>% visOptions(selectedBy = "names") %>% visOptions(selectedBy = "id")
But this just over writes the previous search option.
I have the following data:
nodes_df$names = names
Using this data, I made the following graph network:
The result looks something like this: https://i.stack.imgur.com/zTg9e.png
My Question: I am trying to add another "search bar" to this diagram that also lets you search by "name" - this would look something like this:
https://i.stack.imgur.com/VqOTy.png
My Attempt: I tried to look into this (e.g. https://cran.r-project.org/web/packages/visNetwork/vignettes/Introduction-to-visNetwork.html) and try the following code but got a warning:
I also tried:
Can someone please show me how to fix this?
Thanks!