我很努力地了解如何在R Shiny中使用isolate()
和reactive()
。R有光泽的隔离反应数据。框架
我要实现以下目标:
每当 “刷新” 操作按钮被点击:
执行上data.frame一个
subset
和,进到这个我的函数重新计算值。
该子集依赖于一组复选框的用户已经打勾,其中有大约40我不能有这些复选框“完全反应”,因为该函数需要大约1.5秒来执行。相反,我想让用户有机会选择多个框,然后单击按钮以(a)子集和(b)再次调用该功能。
要做到这一点,我加载data.frame在server.R功能:
df1 <- readRDS("D:/././df1.RData")
然后,我有我的主要shinyServer功能:
shinyServer(function(input, output) {
data_output <- reactive({
df1 <- df1[,df1$Students %in% input$students_selected]
#Here I want to isolate the "students_selected" so that this is only
#executed once the button is clicked
})
output$SAT <- renderTable({
myFunction(df1)
})
}
是的,点击按钮时触发''eventReactive'''。 –