ComeçarComece de graça

Setting a header

In the videos, the header was likened to the signboard or front-end of a restaurant.

In the header, the title of the shinydashboard is defined, and additional elements can be added. Particularly, you saw various types of dropdown lists containing various types of items.

In this exercise, imagine that you have already carried out an analysis of some statistics for a global soccer tournament. You now want to create a dashboard as a means to present these results. To this end, you will first set up the header.

The shiny and shinydashboard packaged have already been loaded for you.

Este exercício faz parte do curso

Building Dashboards with shinydashboard

Ver curso

Instruções do exercício

  • Set the title as "Analysis results for global soccer tournament"
  • Set the title width to 400.
  • Create one dropdown list of type "messages" containing one message item.
  • Add another dropdown list of type "notifications" containing one notification and one task item.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

header <- dashboardHeader(
  # Set the title as "Analysis results for global soccer tournament"
  ___,
  # Set the title width to 400
  ___,
  # Add a dropdown menu containing two messages
  dropdownMenu(type = ___,
       ___("Colleague", "Hello world!")),
  # Add another dropdown menu containing two other items
  ___(___,
       ___("Have you rested today?"),
       ___("Dashboard completion", value = 20)))
sidebar <- dashboardSidebar(); body <- dashboardBody()
ui <- dashboardPage(header, sidebar, body); server <- function(input, output){}
shinyApp(ui, server)
Editar e executar o código