visNetwork-treeModule {visNetwork} | R Documentation |
Module shiny for visualize and customize a rpart
tree
Description
Needed packages : shiny, rpart, colourpicker, shinyWidgets, sparkline
Usage
visTreeModuleServer(
input,
output,
session,
data,
tooltip_data = NULL,
tooltipColumns = "",
main = "",
submain = "",
footer = "",
direction = "UD",
fallenLeaves = FALSE,
rules = TRUE,
simplifyRules = TRUE,
shapeVar = "dot",
shapeY = "square",
colorVar = NULL,
colorY = NULL,
colorEdges = "#8181F7",
nodesFontSize = 16,
edgesFontSize = 14,
edgesFontAlign = "horizontal",
legend = TRUE,
legendNodesSize = 22,
legendFontSize = 16,
legendWidth = 0.1,
legendNcol = 1,
legendPosition = "left",
nodesPopSize = FALSE,
minNodeSize = 15,
maxNodeSize = 30,
highlightNearest = list(enabled = TRUE, degree = list(from = 50000, to = 0), hover =
FALSE, algorithm = "hierarchical"),
collapse = list(enabled = TRUE, fit = TRUE, resetHighlight = TRUE, clusterOptions =
list(fixed = TRUE, physics = FALSE)),
updateShape = TRUE,
tooltipDelay = 500,
digits = 3,
height = 650,
width = "100%",
export = TRUE
)
visTreeModuleUI(
id,
rpartParams = TRUE,
visTreeParams = TRUE,
quitButton = FALSE
)
Arguments
input |
|
output |
|
session |
|
data |
|
tooltip_data |
|
tooltipColumns |
|
main |
Title. See visNetwork |
submain |
Subtitle. See visNetwork |
footer |
Footer. See visNetwork |
direction |
|
fallenLeaves |
|
rules |
|
simplifyRules |
|
shapeVar |
|
shapeY |
|
colorVar |
|
colorY |
if classification tree :
if regression tree : |
colorEdges |
|
nodesFontSize |
|
edgesFontSize |
|
edgesFontAlign |
|
legend |
|
legendNodesSize |
|
legendFontSize |
|
legendWidth |
|
legendNcol |
|
legendPosition |
|
nodesPopSize |
|
minNodeSize |
|
maxNodeSize |
|
highlightNearest |
|
collapse |
|
updateShape |
|
tooltipDelay |
|
digits |
|
height |
|
width |
|
export |
|
id |
|
rpartParams |
|
visTreeParams |
|
quitButton |
|
References
See online documentation https://datastorm-open.github.io/visNetwork/
Examples
## Not run:
require(rpart)
# simple module editor on rpart
data <- iris
shiny::shinyApp(ui = shiny::fluidPage(
visTreeModuleUI(id = "id1", rpartParams = FALSE, visTreeParams = FALSE)),
server = function(input, output, session) {
shiny::callModule(visTreeModuleServer, "id1", data = shiny::reactive(rpart(data)))
})
# full module editor on rpart + data.frame for sparkline
data <- iris
shiny::shinyApp(ui = shiny::fluidPage(
visTreeModuleUI(id = "id1", rpartParams = FALSE, visTreeParams = TRUE)),
server = function(input, output, session) {
shiny::callModule(visTreeModuleServer, "id1", data = shiny::reactive(rpart(data)),
tooltip_data = data)
})
# module on data.frame
shiny::shinyApp(ui = shiny::fluidPage(visTreeModuleUI(id = "id1",
rpartParams = TRUE)),
server = function(input, output, session) {
shiny::callModule(visTreeModuleServer, "id1", data = shiny::reactive(data))
})
# multiple modules
shiny::shinyApp(ui =
navbarPage("Menu",shiny::tabPanel(
"tt1",shiny::fluidPage(visTreeModuleUI(id = "id1",
rpartParams = TRUE,
visTreeParams = TRUE))
),
shiny::tabPanel(
"tt2",shiny::fluidPage(visTreeModuleUI(id = "id2",
rpartParams = FALSE,
visTreeParams = FALSE)))
),
server = function(input, output, session) {
shiny::callModule(visTreeModuleServer, "id1", data = shiny::reactive(iris))
shiny::callModule(visTreeModuleServer, "id2", data = shiny::reactive(rpart(iris)))
})
## End(Not run)