Membangun Dashboard dengan shinydashboard
Png Kee Seng
Researcher
Kita bekerja untuk agen tur di London.
Turis butuh tempat menginap.
Apa yang bisa kita lakukan untuk membantu?


header <- dashboardHeader(
title = "Home rental listings")
sidebar <- dashboardSidebar()
body <- dashboardBody()
ui <- dashboardPage(header,
sidebar,
body)
server <- function(input, output) {}
shinyApp(ui, server)
Di body:
fluidRow(
valueBoxOutput(outputId = "count"),
valueBoxOutput(outputId = "prop"),
valueBoxOutput(outputId = "avg"))
Di server:
output$count <- renderValueBox({
valueBox(..., icon = ...)})
output$prop <- renderValueBox(...)
...
Di body:
box(
side = "right", ...,
sliderInput(inputId = "range",
label = "Pilih rentang harga:",
min = 0,
max = 25000,
value = c(0,25000))
))
Perbarui server, gunakan input$range[1] dan input$range[2]

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

Di body:
selectInput(inputId = "select",
label = "Pilih grup:",
choices = c("Neighbourhood",
"Room Type"))
Di server:
output$plots <- renderPlotly({
if (input$select == ...){plot1}
else if(input$select == ...){plot2}
})
Di body:
box(side = "right", ...,
title = "Selamat datang di London!",
"...")
Perbarui di body:
tabBox(id = "tabset", ...,
tabPanel("Charts", ...),
tabPanel("Data table", ...)

Kita dapat memakai fungsi shiny.
Di body:
dataTableOutput("table")
Di server:
output$table <-
renderDataTable(listings)

Di sidebar:
sidebarMenu(
menuItem("Charts", ...),
menuItem("Map", ...))
Di body:
leafletOutput("map",...)
Di server:
output$map <- renderLeaflet(map)
Membangun Dashboard dengan shinydashboard