Создание дашбордов с помощью shinydashboard
Png Kee Seng
Researcher
Мы работаем в туристическом агентстве в Лондоне.
Туристам нужно жильё.
Как мы можем им помочь?


header <- dashboardHeader(
title = "Home rental listings")
sidebar <- dashboardSidebar()
body <- dashboardBody()
ui <- dashboardPage(header,
sidebar,
body)
server <- function(input, output) {}
shinyApp(ui, server)
В body:
fluidRow(
valueBoxOutput(outputId = "count"),
valueBoxOutput(outputId = "prop"),
valueBoxOutput(outputId = "avg"))
В server:
output$count <- renderValueBox({
valueBox(..., icon = ...)})
output$prop <- renderValueBox(...)
...
В body:
box(
side = "right", ...,
sliderInput(inputId = "range",
label = "Select price range:",
min = 0,
max = 25000,
value = c(0,25000))
))
Обновите server, используя input$range[1] и input$range[2]

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

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

Можно использовать функции shiny.
В body:
dataTableOutput("table")
В server:
output$table <-
renderDataTable(listings)

В sidebar:
sidebarMenu(
menuItem("Charts", ...),
menuItem("Map", ...))
В body:
leafletOutput("map",...)
В server:
output$map <- renderLeaflet(map)
Создание дашбордов с помощью shinydashboard