在 R shiny 中的 shinyBS 弹出窗口中插入一个枢轴 table

Inserting a pivot table inside a shinyBS popover in R shiny

给定的 R 闪亮脚本基于单击显示文本的按钮创建弹出窗口。

library(shiny)
library(shinyBS)
CR1_BS<-paste("i. This is line 1",
          "ii. This is line 2",
          "iii. This is line 3", sep = "<br>")
 ui <- fluidPage(
 actionButton("CR1_S1", "Button"),
 bsPopover(id="CR1_S1",title="x",content=CR1_BS ,"right",options = 
 list(container = "body")))

 server <- function(input, output){}
 shinyApp(ui, server)

我的要求是在单击按钮时在弹出窗口中显示以下 rpivotTable。

 library(rpivotTable)
 rpivotTable(mtcars,rows="gear",cols = c("cyl","carb"),width = "100%", 
 height = "400px")

有这样的事情吗?

rm(list = ls())
library(shiny)
library(shinyBS)
library(rpivotTable)

shinyApp(
  ui =
    fluidPage(
      sidebarLayout(
        sidebarPanel(actionButton("CR1_S1", "Button")),
        mainPanel(
          bsModal("modalExample", "Your Table", "CR1_S1", size = "large",rpivotTableOutput("test"))
        )
      )
    ),
  server =
    function(input, output, session) {

      output$test <- rpivotTable::renderRpivotTable({
        rpivotTable(mtcars,rows="gear",cols = c("cyl","carb"),width = "100%", height = "400px")
      })
    }
)