How can i solve this error : "Error in: object of type 'closure' is not a subset" in shiny APP using datatables

How can i solve this error : "Error in: object of type 'closure' is not a subset" in shiny APP using datatables

我正在制作一个闪亮的应用程序,我需要一个对输入做出反应的数据表,但是当我渲染数据表时出现以下错误

Error in: object of type 'closure' is not a subset

这是server.R

中的函数
  output$elites <- renderUI({
    req(input$iterationsElites)
    allElites <- iraceResults$allElites[[input$iterationsElites]]
    for(i in allElites)
    {
      bestConfiguration <- getConfigurationById(iraceResults, ids=i)
      print(bestConfiguration)
    }
    DT::renderDataTable({
      DT::datatable(
        bestConfiguration
      )
    })
  })

ui.R

      fluidRow(
          box(title = "Elite Configurations",
              status = "primary",
              numericInput("iterationsElites","Select Iteration",value = 1,min = 1,max = iraceResults$state$nbIterations),
              uiOutput("elites"),
              width = 15
          )
        ),

提前致谢

编辑

通过 ID 获取配置:

  .ID. algorithm localsearch alpha beta  rho ants q0 rasrank elitistants nnls  dlb .PARENT.
7    7        as           0  4.96 0.81 0.27   32 NA      NA          NA   NA <NA>       NA
   .ID. algorithm localsearch alpha beta  rho ants q0 rasrank elitistants nnls dlb .PARENT.
52   52        as           1  0.35 6.72 0.11   92 NA      NA          NA    8   0       NA
   .ID. algorithm localsearch alpha beta  rho ants q0 rasrank elitistants nnls dlb .PARENT.
73   73        as           3  0.61 2.29 0.66   34 NA      NA          NA   22   1       NA
   .ID. algorithm localsearch alpha beta  rho ants q0 rasrank elitistants nnls dlb .PARENT.
67   67      mmas           3  2.73 7.98 0.97   34 NA      NA          NA   41   0       NA
   .ID. algorithm localsearch alpha beta  rho ants q0 rasrank elitistants nnls dlb .PARENT.
58   58       eas           2  0.32 2.97 0.72   80 NA      NA          58    6   1       NA

变量allElites包含了通过函数getConfigurationByID获取配置的ID

[1]  7 52 73 67 58

感谢您的回答

"An object of type closure"表示一个函数。错误消息意味着您正在尝试对函数进行子集化(即使用 $ 或括号),这显然没有意义。

因此,仔细检查您的代码,寻找看起来像可子集数据对象但实际上具有函数名称的对象,您会发现您的问题。

此错误通常是由于数据对象名称拼写错误造成的。请注意,如果您使用现有函数的名称定义数据对象,R 将首先找到该数据对象。但是,如果尝试对您命名为 "Sum" 的数据对象进行子集化并将其引用为 "sum"(这是内置函数的名称),您将收到此错误。