【问题标题】:How can I pass data between functions in a Shiny app如何在 Shiny 应用程序中的函数之间传递数据
【发布时间】:2012-11-15 13:05:55
【问题描述】:

我有一个闪亮的应用程序,其中 server.r 包含以下代码

shinyServer(function(input, output) {

  data <- reactive(function() {
   # some processing
   df # dataframe with columns: name,date,count 
 })

  output$plot1 <- reactivePlot(function() {
   # boxplot based on df$count grouped by df$name
 })

 output$plot2 <- reactivePlot(function() {
   # linegraph based on x=df$date, y=df$count grouped by df$name
 })
})     

我如何构造它,以便我可以在 reactivePlots 中引用 df$count 等我在反应函数中创建的“数据”

干杯

【问题讨论】:

    标签: r function shiny


    【解决方案1】:

    使用data()$count() 是您检索反应函数值的方式,而您可以从两个反应绘图函数中看到 data 只是 R 范围规则的自然结果。

    【讨论】:

      猜你喜欢
      • 2016-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多