I'm trying to create a Shiny
App. The user interface UI.R
looks just fine but I'm having issues with server.R
. Basically I want a different plot output depending on which radio
option the user selects.
The user may choose option A
, B
, or C
. I want to draw a histogram if user selects option A
, bar graph for B
, and a pie chart for option C
but I don't know how to code the condition? Is it like an if-else
statement? I've been struggling for hours! Here's my code sample:
output$plots <- renderPlot({
if selection == 'A'
# plot histogram
if selection == 'B'
# plot bar chart
if selection == 'C'
# plot pie chart
})
Thanks!
See Question&Answers more detail:os