Home > Back-end >  How to reactively and repeatedly render the same type of object with an action button in R shiny?
How to reactively and repeatedly render the same type of object with an action button in R shiny?

Time:12-09

The code at the bottom is taken from an example in enter image description here

Code:

library(shiny)

newOutput <- function(x,y){verbatimTextOutput("paste(out,count())")}

ui <- fluidPage(uiOutput("uiButton"))

server <- function(input,output,session){
  count <- reactiveVal(0)
  observeEvent(input$button, {count(count()   1)})
  output$"paste(out,count())" <- renderText({count()})
  count
  
  output$uiButton <-
    renderUI(
      tagList(
        actionButton("button", label = "Click me"),
        newOutput()
      )
    )
}

shinyApp(ui, server)

CodePudding user response:

Adapting this enter image description here

  • Related