This is a minimal work example of a larger application in R shiny that I'm working on at the moment. Each time I click the actionbutton "OK" I want to generate a new randam variable between 1 and 3 and display it. I get the following error message: Shiny app fails with “argument 1 (type 'closure') cannot be handled by 'cat'” - what does this mean?
ui <- fluidPage(
titlePanel("Random Veriable"),
actionButton("ok", "OK"),
br(),
verbatimTextOutput("anubis")
)
server <- function(input, output) {
anu <- eventReactive(input$ok,{
sample(c(1:3), size = 1, replace = T)
})
output$anubis <- renderText({
if(input$ok > 0)
{
anu
}
else{
0
}
})
}
I'd be happy if someone could show me where I went wrong in defining my variable anu.
Aucun commentaire:
Enregistrer un commentaire