动作按钮的小部件示例在闪亮的不起作用

时间:2014-07-02 14:32:04

标签: r shiny shiny-server

我玩弄闪亮,并且无法使用最简单的操作按钮示例。

此处的第一个示例:http://shiny.rstudio.com/gallery/widgets-gallery.html

以下是代码,它是网站上的复制粘贴。

#ui.R
shinyUI(fluidPage(

  # Copy the line below to make an action button
  actionButton("action", label = "Action"),

  hr(),
  fluidRow(column(2, verbatimTextOutput("value")))

))


#server.R
shinyServer(function(input, output) {

  # You can access the value of the widget with input$action, e.g.
  output$value <- renderPrint({ input$action })

})

我看起来像: http://imgur.com/t0Vx6Wr

编辑: 问题是它还打印出一些类信息 感谢

1 个答案:

答案 0 :(得分:1)

如果您希望它在renderText网站上显示,请使用renderPrint而不是shiny

require(shiny)
runApp(list(ui = fluidPage(
  actionButton("action", label = "Action"),
  hr(),
  fluidRow(column(2, verbatimTextOutput("value")))
)
, server = function(input, output) {
  output$value <- renderText({ input$action })  
})
)

enter image description here

相关问题