Creare dashboard con shinydashboard
Png Kee Seng
Researcher
Lavoriamo per un’agenzia turistica a Londra.
I turisti hanno bisogno di un alloggio.
Come possiamo aiutarli?


header <- dashboardHeader(
title = "Home rental listings")
sidebar <- dashboardSidebar()
body <- dashboardBody()
ui <- dashboardPage(header,
sidebar,
body)
server <- function(input, output) {}
shinyApp(ui, server)
In body:
fluidRow(
valueBoxOutput(outputId = "count"),
valueBoxOutput(outputId = "prop"),
valueBoxOutput(outputId = "avg"))
In server:
output$count <- renderValueBox({
valueBox(..., icon = ...)})
output$prop <- renderValueBox(...)
...
In body:
box(
side = "right", ...,
sliderInput(inputId = "range",
label = "Seleziona l’intervallo di prezzo:",
min = 0,
max = 25000,
value = c(0,25000))
))
Aggiorna server usando input$range[1] e input$range[2]

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

In body:
selectInput(inputId = "select",
label = "Seleziona il gruppo:",
choices = c("Neighbourhood",
"Room Type"))
In server:
output$plots <- renderPlotly({
if (input$select == ...){plot1}
else if(input$select == ...){plot2}
})
In body:
box(side = "right", ...,
title = "Benvenuto a Londra!",
"...")
Aggiornamento in body:
tabBox(id = "tabset", ...,
tabPanel("Grafici", ...),
tabPanel("Tabella dati", ...)

Possiamo usare le funzioni di shiny.
In body:
dataTableOutput("table")
In server:
output$table <-
renderDataTable(listings)

In sidebar:
sidebarMenu(
menuItem("Grafici", ...),
menuItem("Mappa", ...))
In body:
leafletOutput("map",...)
In server:
output$map <- renderLeaflet(map)
Creare dashboard con shinydashboard