I have a Shiny app in which I have a network graph rendered using ggraph
, something similar to the app below:
library(ggraph)
library(igraph)
library(shiny)
ui <- fluidPage(
plotOutput("plot", brush = brushOpts(id = "plot_brush"))
)
server <- function(input, output) {
graph <- graph_from_data_frame(highschool)
output$plot <- renderPlot({
ggraph(graph) +
geom_edge_link(aes(colour = factor(year))) +
geom_node_point()
})
observe(print(
brushedPoints(as_data_frame(graph, what = "vertices"), input$plot_brush)
)
)
}
shinyApp(ui, server)
What I'm looking to do is when you click and drag in a chart so that some nodes are captured, I can examine more information about those specific points captured. For now, I'm just using observe({print()})
so that I can see in the console what gets captured.
My problem, whenever I select an area in the app, I get 0 rows returned in the console, no matter how many nodes are included in the area selected. How do I make it return the nodes included in the area selected?