शुरू करेंमुफ़्त में शुरू करें

अपना पहला डैशबोर्ड बनाना

डेटा को soccer नाम के एक data frame में सेव किया गया है. 3 प्री-डिफाइंड प्लॉट दिए गए हैं:

  • goals_plot: हर टीम द्वारा किए गए गोलों की संख्या
  • yellow_plot, red_plot: हर टीम को दिए गए पीले/लाल कार्डों की संख्या

यहाँ कुछ कस्टम हेल्पर फंक्शन्स इस्तेमाल हुए हैं:

  • daytime_fn(): किसी खास मैच का दिन और समय देता है
  • venue_fn(): किसी खास मैच का venue देता है
  • grp_fn(): मैचअप का group देता है
  • team1_fn(), team2_fn(): टीम 1/2 के नाम देता है
  • score1_fn(), score2_fn(): टीम 1/2 द्वारा किए गए गोलों की संख्या देता है

यह अभ्यास पाठ्यक्रम का हिस्सा है

shinydashboard के साथ डैशबोर्ड बनाना

पाठ्यक्रम देखें

अभ्यास निर्देश

  • पहले टैब/पेज की पहली से तीसरी पंक्ति में दिए गए आउटपुट के लिए खाली जगहें भरिए.
  • दूसरे पेज में प्लॉट आउटपुट के लिए खाली जगहें भरिए, जिनके नाम "goals", "yellow" और "red" हैं.
  • UI और server को साथ रखकर shinydashboard रेंडर कीजिए.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

body <- dashboardBody(tabItems(
  tabItem(tabName = "matchtab", 
  fluidRow(selectInput("match", "Match number", choices = 1:nrow(soccer)),
           infoBoxOutput("daytime"), infoBoxOutput("venue"), infoBoxOutput("grp")),
  fluidRow(valueBoxOutput("team1", width = 3), valueBoxOutput("score1", width = 3), 
           valueBoxOutput("team2", width = 3), valueBoxOutput("score2", width = 3)),
  fluidRow(plotOutput("histogram"))),
  tabItem(tabName = "statstab", 
          tabBox(tabPanel("Goals", plotOutput("goals", height = "700px")),
                 tabPanel("Yellow cards", plotOutput("yellow", height = "700px")),
                 tabPanel("Red cards", plotOutput("red"))))
))

ui <- dashboardPage(header, sidebar, body)

server <- function(input, output) {
  # Fill in outputs in first to third rows of the first page
  output$daytime <- renderInfoBox(infoBox("Day and time", 
                                          daytime_fn(input$match), 
                                          icon = icon("calendar"), 
                                          color = "green"))
  output$venue <- ___(infoBox("Venue", 
                                        venue_fn(input$match), 
                                        icon = icon("map"), 
                                        color = "green"))
  output$___ <- ___(___("Group", 
                                      grp_fn(input$match), 
                                      color = "green"))
  output$team1 <- ___(valueBox("Team 1", team1_fn(input$match), color = "blue"))
  output$score1 <- ___(___("# of goals", score1_fn(input$match), color = "blue"))
  output$___ <- ___(valueBox("Team 2", team2_fn(input$match), color = "red")) 
  ___ <- ___(valueBox("# of goals", score2_fn(input$match), color = "red"))
  output$histogram <- renderPlot(plot_histogram(input$match))
  # Fill in outputs in the second page
  output$goals <- ___(goals_plot)
  output$___ <- ___(yellow_plot)
  ___ <- ___(red_plot)
}

# Put the UI and server together
___
कोड संपादित करें और चलाएँ