Creare dashboard con shinydashboard
Png Kee Seng
Researcher
dashboardBody() e di solito salvato in bodybody <- dashboardBody(...)

fluidRow()box()
body <- dashboardBody(fluidRow(box("Riga 1, box 1"), box("Riga 1, box 2")), fluidRow(box("Riga 2, box 1"), box("Riga 2, box 2")))

body <- dashboardBody( fluidRow(box("Riga 1, box 1",plotOutput('plot')),box("Riga 1, box 2")), fluidRow(box("Riga 2, box 1"), box("Riga 2, box 2",selectInput("select", "Seleziona numero squadra:", choices = c(1,2)))))
widthbox() è fortemente consigliato
body <- dashboardBody(
fluidRow(box("Riga 1, box 1"),
box("Riga 1, box 2"),
box("Riga 1, box 3")),
fluidRow(box("Riga 2, box 1"),
box("Riga 2, box 2"))
)
body <- dashboardBody(
fluidRow(box("Riga 1, box 1", width = 3),
box("Riga 1, box 2", width = 5),
box("Riga 1, box 3", width = 4)),
fluidRow(box("Riga 2, box 1"),
box("Riga 2, box 2"))
)
valueBox()infoBox()
body <- dashboardBody( fluidRow(valueBox(value = 3, subtitle = "Tot. cartellini rossi assegnati", icon = icon("user"), color = "red"),infoBox(value = 158, title = "Tot. goal segnati", icon = icon("futbol")) ))
valueBox() e infoBox():
valueBoxOutput() e infoBoxOutput()renderValueBox() e renderInfoBox()valueBox() e infoBox()
body <- dashboardBody(
fluidRow(valueBoxOutput(outputId = "valuebox1"),
infoBoxOutput(outputId = "infobox1")
))
server <- function(input, output){
output$valuebox1 <- renderValueBox(
valueBox(3, "Tot. cartellini rossi assegnati",
icon = icon("user"), color = "red"))
output$infobox1 <- renderInfoBox(
infoBox(158,
title = "Tot. goal segnati",
icon = icon("futbol")))
}
plotOutput():renderPlot():server()ggplot()valueBoxOutput():renderValueBox():server()valueBox()tabItems()tabItem()menuItem()-tabItem() devono coincidere
sidebar <- dashboardSidebar( sidebarMenu( id = "pages",menuItem("Many charts", tabName = "charts", icon = icon("chart-line"), badgeLabel = "New content!", badgeColor = "green"),menuItem("Statistics", icon = icon("file-excel"), tabName = "statistics", badgeLabel = "urgent", badgeColor = "red") ))body <- dashboardBody( tabItems(tabItem("charts", "I grafici vanno qui." ), tabItem("statistics", "Le statistiche vanno qui." )))
tabsetPanel()tabPanel()tabItems() e tabItem()
body <- dashboardBody(tabsetPanel(tabPanel("Distributions", box(plotOutput("dist"))), tabPanel("Statistics", dateInput("matchdate", "Inserisci la data della partita:", value = "2022-11-20"), valueBoxOutput("red"), valueBoxOutput("yellow")), tabPanel("Data", "I dati vanno qui.", tableOutput("data"))))server <- function(input, output){ output$red <- renderValueBox(valueBox(0, "Cartellini rossi")) output$yellow <- renderValueBox(valueBox(6, "Cartellini gialli")) }
Creare dashboard con shinydashboard