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
• 10,290 points
307 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,000 points

Related Questions In Data Analytics

0 votes
1 answer
0 votes
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
47 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 4, 2018 in Data Analytics by Kalgi
• 35,800 points
22 views
0 votes
1 answer

Error saying 'shinyServer(function(input,output){ output`$histogram`" while creating dashboard using shiny R

Try this for your server.R library(shiny) library(shinydashboard) shinyServer(function(input,output){ output$`$histogram`<- ...READ MORE

answered Nov 29, 2018 in Data Analytics by Maverick
• 10,000 points
48 views
0 votes
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,000 points
238 views
0 votes
1 answer

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

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

answered Nov 28, 2018 in Data Analytics by Maverick
• 10,000 points
131 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 29, 2018 in Data Analytics by Maverick
• 10,000 points
37 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.