Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
242 views
in Technique[技术] by (71.8m points)

r - 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.
question from:https://stackoverflow.com/questions/65928643/utilizing-a-slider-and-an-action-button-in-a-shiny-app

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...