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,440 points
822 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,040 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
314 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
• 45,780 points
87 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 13 in Data Analytics by payal
19 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,040 points
495 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,040 points
303 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,040 points
62 views