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.)