user18293422
user18293422

Reputation:

Print output R shiny

can anyone explain to me how to view an output on r shiny? The code of my app is very long, you can find it at this link Print output on R shiny that is a very similar question, however, I have not received an answer. My question is: once I have created a dataframe, how do I print it? I insert the most important part of the code in my opinion:

 shiny::observeEvent(input$modmatbut, {
    disegno<<-as.data.frame(oa.design(factor.names=values$levnames))
    })

input$modmatbut is when is when the button is pressed. This function works (I insert the photo of an output obtained and as you can see it is a dataframe) Now, I would like diesgno to be printed on the screen enter image description here

Upvotes: 0

Views: 628

Answers (1)

Pork Chop
Pork Chop

Reputation: 29387

Can you maybe switch to using eventReactive and access the table via disegno()

library(shiny)

ui <- fluidPage(
  actionButton("modmatbut","modmatbut"),
  tableOutput("draw")
)

server <- function(input, output, session){
  
  disegno <- eventReactive(input$modmatbut,{
    as.data.frame(oa.design(factor.names=values$levnames))
  })
  
  output$draw <- renderTable({
    disegno()
  })
  
}

shinyApp(ui, server)

Upvotes: 1

Related Questions