# NOT RUN {
# }
# NOT RUN {
nodes <- data.frame(id = 1:3, title = paste0("<p>", 1:3,"<br> tooltip</p>"))
edges <- data.frame(from = c(1,2), to = c(1,3))
# don't look in RStudio viewer
visNetwork(nodes, edges) %>%
visConfigure(enabled = TRUE, filter = "interaction")
# shiny
# Define UI
ui <- shinyUI(fluidPage(
fluidRow(column(4, div(id = "config")),
column(8,visNetworkOutput("network"))
)
))
# Define SERVER
server <- shinyServer(function(input, output) {
output$network <- renderVisNetwork({
nodes <- data.frame(id = 1:15, label = paste("Label", 1:15),
group = sample(LETTERS[1:3], 15, replace = TRUE))
edges <- data.frame(from = trunc(runif(15)*(15-1))+1,
to = trunc(runif(15)*(15-1))+1)
visNetwork(nodes, edges) %>% visConfigure(enabled = TRUE, container = "config")
})
})
# Run the application
shinyApp(ui = ui, server = server)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab