我正在尝试从 R 的数据库动态构建数据集。下面是我用于相同的代码,但在运行它时出现错误。应用程序正在闪亮运行。
query <- "select * from rdataset" # [col-2]dataset name [col-3]Query
qresult<- dbGetQuery(con,query)
dataset <- reactiveValues()
for (i in 1:nrow(qresult)) {
qresult1 <- dbGetQuery(con,qresult[i,3]) # fetching the data from db
dataset$qresult[i,2] <- qresult1 #assigning it to dataset so that it can be used later
}
#dataset$MOH<- qresult1 # this line works
运行时出现以下错误
Error in .getReactiveEnvironment()$currentContext() :
Operation not allowed without an active reactive context. (You tried to do something that can only be done from inside a reactive function.)