Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 如何从一个反应函数中引用两个数据帧_R_Shiny - Fatal编程技术网

R 如何从一个反应函数中引用两个数据帧

R 如何从一个反应函数中引用两个数据帧,r,shiny,R,Shiny,我在server.r test <- reactive({ test_1 test_2 }) output$table1 <- renderTable({ test_1 }) output$table2 <- renderTable({ test_2 }) test尝试将反应性数据帧放入列表: test <- reactive({ test_1 test_2 testData <- list(test_1, test_2)

我在
server.r

 test <- reactive({ 

 test_1
 test_2

})

output$table1 <- renderTable({

 test_1
})

output$table2 <- renderTable({

 test_2
})

test尝试将反应性数据帧放入列表:

test <- reactive({ 
  test_1
  test_2
  testData <- list(test_1, test_2)
  testData ## added this
})

output$table1 <- renderTable({
  testData <- test()
  testData$test_1
})
output$table2 <- renderTable({
  testData <- test()      
  testData$test_2
})

test尝试将反应性数据帧放入列表:

test <- reactive({ 
  test_1
  test_2
  testData <- list(test_1, test_2)
  testData ## added this
})

output$table1 <- renderTable({
  testData <- test()
  testData$test_1
})
output$table2 <- renderTable({
  testData <- test()      
  testData$test_2
})

test引用多个数据帧的正确方法如下

test <- reactive({ 
  test_1
  test_2
  list(df1 = test_1, df2 = test_2)

})

output$table1 <- renderTable({
   test()[['df1']]
})
output$table2 <- renderTable({
   test()[['df2']]
})

test引用多个数据帧的正确方法如下

test <- reactive({ 
  test_1
  test_2
  list(df1 = test_1, df2 = test_2)

})

output$table1 <- renderTable({
   test()[['df1']]
})
output$table2 <- renderTable({
   test()[['df2']]
})

test我刚刚在reactive函数中添加了一行,以指定返回testData。如果这不起作用,请告诉我。我仍然会收到与上面所述相同的错误
testData not found
Correct。我没有使用实际的MWE,很高兴“将其放入列表”方法对您有效。我只是在反应式函数中添加了一行所需的代码,以指定返回testData。如果这不起作用,请告诉我。我仍然会收到与上面所述相同的错误
testData not found
Correct。我没有和一个真正的MWE一起工作,很高兴“把它放在列表中”的方法对你有效。