0

我正在玩弄闪亮的东西,但无法让最简单的动作按钮示例起作用。

在这里找到的第一个例子: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

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

4

1 回答 1

1

如果您希望它看起来像在网站上一样,请使用renderText而不是:renderPrintshiny

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 })  
})
)

在此处输入图像描述

于 2014-07-02T14:39:29.237 回答