0

The given R shiny script creates popoup based on clicking of a button in which the text is displayed.

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)

My requirement is to fit the below rpivotTable in the popup upon clicking of the button.

 library(rpivotTable)
 rpivotTable(mtcars,rows="gear",cols = c("cyl","carb"),width = "100%", 
 height = "400px")
Adam Shaw
  • 519
  • 9
  • 24

1 Answers1

1

Something like this do?

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")
      })
    }
)
Pork Chop
  • 28,528
  • 5
  • 63
  • 77