0
创建一个应用程序,我在其中使用sliderInput并从用户&中选择输入,当我们单击动作按钮时显示它。当我们运行应用程序代码时,运行良好,但是当我们更改滑块输入&中的值时,无需单击按钮即可自动显示selectInput输出。在动作按钮上单击显示selectInput和sliderInput值单击
shinyUI(fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar
sidebarLayout(
sidebarPanel(
sliderInput("tm", "select the interval", min = 0, max = 20,value = 10),
selectInput("samples", label = "Select the sample type", c("Sample A","Sample B","Sample C")),
actionButton("act", label = " Update")
),
mainPanel(
textOutput("val"),
br(),
textOutput("sam")
)
)
))
shinyServer(function(input, output) {
observe(
if(input$act>0){
output$val <- renderText(
paste("You selected the value" ,input$tm)
)
output$sam <- renderText(input$samples)
}
)
})
我想只在单击操作按钮时更改该值。