LoslegenKostenlos loslegen

checkboxInput and checkboxGroupInput

You will now try another example involving checkbox inputs. As mentioned in the video, this can be done using checkboxInput() if you only need a single checkbox, and checkboxGroupInput() if you need multiple checkboxes.

In your shinyApp, you may also want users to be able to select types of days of the week, since people may have different sleeping habits depending on the day of the week. You may, for example, tend to sleep a tad later if you don't have school or work the next day.

In this exercise, you will allow users to select one of the following options:

  1. "All days"
  2. "Nonholiday weekdays"
  3. "Weekend days and holidays"

The shiny library has already been loaded for you here.

Diese Übung ist Teil des Kurses

Building Dashboards with shinydashboard

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

ui <- fluidPage(
  titlePanel("Sleeping habits in America"), 
  # Add a checkbox input
  ___("checkboxlabel",
              # Set the name and initial value
              ___, value = ___))
server <- function(input, output, session) {
}

shinyApp(ui, server)
Code bearbeiten und ausführen