Add radio buttons on shiny R dashboard

0 votes
I need a functionality where the graph is plotted based on the element selected from the radio button. Is that possible?
Dec 5, 2018 in Data Analytics by Ali
• 11,360 points
3,477 views

1 answer to this question.

0 votes

Yess of course that's possible. ShinyR provides a function called radioButtons. 

syntax:

radioButtons(inputId, label, choices, selected = NULL, inline = FALSE,
  width = NULL)

Example:

ui <- fluidPage(
 radioButtons("dist", "Distribution type:", c("Normal" = "norm", "Uniform" = "unif", "Log-normal" = "lnorm", "Exponential" = "exp")), 
plotOutput("distPlot") 
)
server <- function(input, output) { 
output$distPlot <- renderPlot({ dist <- switch(input$dist, norm = rnorm, unif = runif, lnorm = rlnorm, exp = rexp, rnorm) 
hist(dist(500)) 

}) 

}
answered Dec 5, 2018 by Maverick
• 10,840 points

Related Questions In Data Analytics

0 votes
1 answer
+1 vote
1 answer

How to add videos in a shiny R dashboard?

Its pretty simple, try this: server.r library(shiny) shinyServer(function(input, output, session) ...READ MORE

answered Dec 4, 2018 in Data Analytics by Haseeb
4,022 views
0 votes
2 answers

How to add sliderbars in a shiny R dashboard?

To add slider bar and slider range ...READ MORE

answered Dec 5, 2018 in Data Analytics by Kalgi
• 52,360 points
1,355 views
0 votes
0 answers

R Shiny - How to add hierarchial widgets from previous selection without buttons?

How to add hierarchial widgets from previous ...READ MORE

Aug 14, 2019 in Data Analytics by payal
450 views
+1 vote
1 answer

Error saying "could not find function "shinyUI"" in shiny R

Its a small spelling mistake that you've ...READ MORE

answered Nov 28, 2018 in Data Analytics by Maverick
• 10,840 points
2,564 views
+1 vote
1 answer

Error saying "could not find function dashboardPage" in shiny R

Include this line in the code: Library(shinydashboard) READ MORE

answered Nov 29, 2018 in Data Analytics by Maverick
• 10,840 points
3,528 views
0 votes
1 answer

How do I add Icons to my messages on my dashboard which I’m creating using shiny r?

Try something like this: dashboardHeader(title="Edureka", dropdownMenu type = "message", messageItem(from = ...READ MORE

answered Nov 30, 2018 in Data Analytics by Maverick
• 10,840 points
841 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP