Rshiny:-上传数据并删除其参数(列),然后单击一下即可恢复

时间:2018-07-25 11:20:49

标签: shiny shiny-reactivity

runApp(shinyApp(ui=(fluidPage(

titlePanel("data frame"),

mainPanel(
  fileInput("file", "Upload file"),

  numericInput("Delete", "Delete Columns:", 1, step = 1),
  actionButton("Go", "Delete!"),actionButton("Restore", "Restore"),

  tableOutput("df_data_out")
)
)),
server = (function(input, output) {
values <- reactive({ df_data = read.csv(input$file$datapath) })

observeEvent(input$file, {
  values()
})

observeEvent(input$Restore, {
  values()
})


observeEvent(input$Go, {
  temp <- values()[,-input$Delete ]
  values() <- temp

})

output$df_data_out <- renderTable({values()})
})))

当我按Delete或Restore时,它会弹出错误并断开连接。 错误是

Warning: Error in <-: invalid (NULL) left side of assignment

我们如何更新rshiny中的反应性元素?要么, 还有其他方法可以将反应堆分配给反应堆本身。

0 个答案:

没有答案