Construindo dashboards com shinydashboard
Png Kee Seng
Researcher
Trabalhamos para uma agência de turismo em Londres.
Turistas precisam de um lugar para ficar.
Como podemos ajudar?


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

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

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

Podemos usar funções do shiny.
Em body:
dataTableOutput("table")
Em server:
output$table <-
renderDataTable(listings)

Em sidebar:
sidebarMenu(
menuItem("Charts", ...),
menuItem("Map", ...))
Em body:
leafletOutput("map",...)
Em server:
output$map <- renderLeaflet(map)
Construindo dashboards com shinydashboard