BaşlayınÜcretsiz Başlayın

Practicing sliderInput

You have seen some common examples of shinyApp inputs in the video. You will first practice with sliderInput, which will give you either a one-sided or two sided slider.

Suppose you are building a shinyApp based on some sleep data which has been stored as sleep. You now want to allow the app user to filter the data by selecting a range of values for the average number of hours spent sleeping.

In this exercise, the shiny library has already been loaded for you.

Bu egzersiz

Building Dashboards with shinydashboard

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

ui <- fluidPage(
  titlePanel("Sleeping habits in America"), 
  sliderInput("sliderlabel",
              "Average hours of sleep",
              # Set the min and max values
              min = ___, max = ___,
              # Set the initial value to 8
              value = ___,
              # Set the step size to 0.5
              step = 0.2))
server <- function(input, output, session) {
}

shinyApp(ui, server)
Kodu Düzenle ve Çalıştır