简体   繁体   English

根据shinydashboard中选择的ActionButton定义dataframe

[英]Define dataframe based on selected ActionButton in shinydashboard

I have 3 action buttons (base,best,worst) and 3 dataframes (also called base,best,worst).我有 3 个操作按钮(基本、最佳、最差)和 3 个数据框(也称为基本、最佳、最差)。

I want that the new data frame I am trying to create, forecast, is populated (or generated?), according to the button the user clicks.Ive tried something like below but i am getting an "object not found, error".Not sure what I am doing wrong?我希望根据用户单击的按钮填充(或生成?)我尝试创建、预测的新数据框。我尝试过类似下面的操作,但我得到一个“找不到对象,错误”。不是确定我做错了什么?

forecast <- reactiveValues(data = data.frame())
      
      observeEvent(input$base, {
        data<-base
          })
      
      observeEvent(input$best, {
        data<-best
      })
      
      observeEvent(input$worst, {
        data<-worst
      })
      

You forgot to use the name forecast of the reactiveValues :您忘记使用reactiveValues的名称forecast

forecast <- reactiveValues(data = data.frame())
      
      observeEvent(input$base, {
        forecast$data<-base
          })
      
      observeEvent(input$best, {
        forecast$data<-best
      })
      
      observeEvent(input$worst, {
        forecast$data<-worst
      })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM