Créer des tableaux de bord avec shinydashboard
Png Kee Seng
Researcher
Nous travaillons pour une agence de voyages à Londres.
Les touristes ont besoin d'un logement.
Que pouvons-nous faire pour les aider ?


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

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

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

Nous pouvons utiliser des fonctions shiny.
Dans body :
dataTableOutput("table")
Dans server :
output$table <-
renderDataTable(listings)

Dans sidebar :
sidebarMenu(
menuItem("Charts", ...),
menuItem("Map", ...))
Dans body :
leafletOutput("map",...)
Dans server :
output$map <- renderLeaflet(map)
Créer des tableaux de bord avec shinydashboard