Tvorba dashboardů pomocí shinydashboard
Png Kee Seng
Researcher
Pracujeme pro cestovní agenturu v Londýně.
Turisté potřebují místo k ubytování.
Jak jim můžeme pomoci?


header <- dashboardHeader(
title = "Home rental listings")
sidebar <- dashboardSidebar()
body <- dashboardBody()
ui <- dashboardPage(header,
sidebar,
body)
server <- function(input, output) {}
shinyApp(ui, server)
V body:
fluidRow(
valueBoxOutput(outputId = "count"),
valueBoxOutput(outputId = "prop"),
valueBoxOutput(outputId = "avg"))
V server:
output$count <- renderValueBox({
valueBox(..., icon = ...)})
output$prop <- renderValueBox(...)
...
V body:
box(
side = "right", ...,
sliderInput(inputId = "range",
label = "Select price range:",
min = 0,
max = 25000,
value = c(0,25000))
))
Aktualizujte server pomocí input$range[1] a input$range[2]

V body:
plotlyOutput("plots",
height = 500,
width = 600)
V server:
output$plots <- renderPlotly({
...
})

V body:
selectInput(inputId = "select",
label = "Select group:",
choices = c("Neighbourhood",
"Room Type"))
V server:
output$plots <- renderPlotly({
if (input$select == ...){plot1}
else if(input$select == ...){plot2}
})
V body:
box(side = "right", ...,
title = "Welcome to London!",
"...")
Aktualizujte v body:
tabBox(id = "tabset", ...,
tabPanel("Charts", ...),
tabPanel("Data table", ...)

Lze použít funkce shiny.
V body:
dataTableOutput("table")
V server:
output$table <-
renderDataTable(listings)

V sidebar:
sidebarMenu(
menuItem("Charts", ...),
menuItem("Map", ...))
V body:
leafletOutput("map",...)
V server:
output$map <- renderLeaflet(map)
Tvorba dashboardů pomocí shinydashboard