กรณีศึกษา: การสร้างเว็บแอปพลิเคชันด้วย Shiny ใน R
Dean Attali
Shiny Consultant
แหล่งข้อมูล 3 แหล่งสำหรับ word cloud
artofwartextAreaInput()fileInput()ขั้นตอนถัดไป: ใช้งานทั้งหมดพร้อมกัน

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

radioButtons(
"time_of_day", "Choose your favorite time of day",
choices = c("I'm a morning person!" = "Morning",
"Love my afternoons" = "Afternoon",
"Night owl here!" = "Evening"),
selected = "Afternoon"
)

str(input$time_of_day)
chr "Afternoon"
conditionalPanel(condition, ...)
condition คล้ายกับโค้ด R แต่ใช้ input.<id> แทน input$<id>... คือ UI ใดก็ได้ui <- fluidPage(
radioButtons("time_of_day",
"Choose your favorite time of day",
...),
plotOutput("morning_only_plot")
)
ui <- fluidPage(
radioButtons("time_of_day",
"Choose your favorite time of day",
...),
conditionalPanel(
condition = "input.time_of_day == 'Morning'",
plotOutput("morning_only_plot")
)
)
กรณีศึกษา: การสร้างเว็บแอปพลิเคชันด้วย Shiny ใน R