如何更新R中闪亮的按钮标签? [英] How to update button labels in R Shiny?
本文介绍了如何更新R中闪亮的按钮标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
第r闪亮的网站有一个如何更新很好的例子的各种基于用户输入的输入类型的标签和值。但是,我找不到任何按键。具体来说,根据用户的输入如何更新一个按钮的标签?
The R Shiny website has a great example of how to update the labels and values of a variety of input types based on user input. However, I couldn't find anything for buttons. Specifically, how do I update the label for a button based on user input?
推荐答案
您可以动态创建像这样的按钮,同时更新标签:
You can dynamically create the Button like so, updating the labels at the same time:
library(shiny)
ui =(pageWithSidebar(
headerPanel("Test Shiny App"),
sidebarPanel(
textInput("sample_text", "test", value = "0"),
#display dynamic UI
uiOutput("my_button")),
mainPanel()
))
server = function(input, output, session){
#make dynamic button
output$my_button <- renderUI({
actionButton("action", label = input$sample_text)
})
}
runApp(list(ui = ui, server = server))
这篇关于如何更新R中闪亮的按钮标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文