Minimal working example
Let's say I want to have a custom version renderDataTablethat I will name myRenderDataTableand work by wrapping around renderDataTable:
library(shiny)
runApp(list(
ui = basicPage(
actionButton("button", "Increase input"),
tabsetPanel(
tabPanel("table1", shiny::dataTableOutput("table1")),
tabPanel("table2", shiny::dataTableOutput("table2")),
tabPanel("table3", shiny::dataTableOutput("table3"))
)
),
server = function(input, output) {
myRenderDataTable <- function(a) {
renderDataTable(
data.frame(x = a, y = a^2, z = a^3),
options = list(bPaginate = as.logical(a %% 2))
)
}
output$table1 <- myRenderDataTable(input$button)
output$table2 <- myRenderDataTable(input$button + 1)
output$table3 <- myRenderDataTable(input$button + 2)
}
))
Problem
Unfortunately, it myRenderDataTabledoesn't seem to react like that renderDataTable. Pressing the button Increase inputshould change the table values, but this is not so.
So what's wrong?
Attempt: Call Transfer reactive:
Execution output$table1 <- reactive(myRenderDataTable(input$button))) leads to:
Error during wrapup: evaluation nested too deeply: infinite recursion / options(expressions=)?
Error : evaluation nested too deeply: infinite recursion / options(expressions=)?
Attempt: Call Transfer observe:
Execution observe(output$table1 <- myRenderDataTable(input$button))did not affect the problem
mchen source
share