James Downey
James Downey

Reputation: 3

Utilizing a slider and an action button in a Shiny App

This is the code that I currently have typed up:

ui <- fluidPage(
  leafletOutput("mymap"), 
  p(),
  actionButton("Date", "BLUFOR", "OPFOR"),
  
  sliderInput("integer", "Integer:",
             min = 3, max = 18,
             value = 10,),
  icon(),
  tableOutput("values")
)

This is the error that I get:

Error in validateIcon(icon) : 
  Invalid icon. Use Shiny's 'icon()' function to generate a valid icon.

Upvotes: 0

Views: 244

Answers (1)

Ronak Shah
Ronak Shah

Reputation: 388807

The third argument to actionButton() is icon which is used to display an icon on button. "OPFOR" is not a valid value for it hence you get the error. Try :

library(shiny)

ui <- fluidPage(
  leafletOutput("mymap"), 
  p(),
  actionButton("Date", "BLUFOR"),
  
  sliderInput("integer", "Integer:",
              min = 3, max = 18,
              value = 10),
  tableOutput("values")
)
server <- function(input, output) {}
shinyApp(ui, server)  

enter image description here

Upvotes: 1

Related Questions