Більше типів введення

Case Studies: створення вебзастосунків із Shiny в R

Dean Attali

Shiny Consultant

Застосунок із графіком Gapminder

chapter2_3_more_input_types.003.png

Case Studies: створення вебзастосунків із Shiny в R

Повзунки (slider inputs)

sliderInput("slider", "Choose a number",
            value = 15, min = 5, max = 20)

chapter2_3_more_input_types.004.png

sliderInput("slider2", "Choose a number",
            value = c(10, 15), min = 5, max = 20)

chapter2_3_more_input_types.006_b.png

str(input$slider2)
num [1:2] 10 15
Case Studies: створення вебзастосунків із Shiny в R

Перемикачі (radio buttons)

radioButtons("radio", "Choose your favorite time of day",
             choices = c("Morning", "Afternoon", "Evening"),
             selected = "Afternoon")

chapter2_3_more_input_types.009.png

Case Studies: створення вебзастосунків із Shiny в R

Випадаючі списки (select inputs)

selectInput("select", "Choose your favorite time of day",
            choices = c("Morning", "Afternoon", "Evening"),
            selected = "Afternoon")

chapter2_3_more_input_types.013.png

Case Studies: створення вебзастосунків із Shiny в R

Випадаючі списки (select inputs)

selectInput("select", "Choose your favorite time of day",
            choices = c("Morning", "Afternoon", "Evening"),
            selected = "Afternoon")

chapter2_3_more_input_types.014.png

Case Studies: створення вебзастосунків із Shiny в R

Випадаючі списки (select inputs)

selectInput("select", "Choose your favorite time of day",
            choices = c("Morning", "Afternoon", "Evening"),
            selected = "Afternoon")

chapter2_3_more_input_types.015.png

Case Studies: створення вебзастосунків із Shiny в R

Випадаючі списки (select inputs)

  • Дозволити кілька виборів
selectInput("select", "Choose your favorite time of day",
            choices = c("Morning", "Afternoon", "Evening"),
            selected = c("Afternoon", "Evening"),
            multiple = TRUE)

chapter2_3_more_input_types.016.png

Case Studies: створення вебзастосунків із Shiny в R

Перемикачі vs випадаючі списки

  • Перемикачі
    • Небагато варіантів
    • Усі варіанти видно
    • Обрано рівно один варіант
  • Випадаючі списки
    • Мало або багато варіантів
    • Важче побачити всі варіанти
    • Можна вибрати кілька варіантів

chapter2_3_more_input_types.018.png

Case Studies: створення вебзастосунків із Shiny в R

Давайте потренуємось!

Case Studies: створення вебзастосунків із Shiny в R

Preparing Video For Download...