Hi There,
I ran this coding:
if (interactive()) {
ui <- fluidPage(
actionButton("minus", "-1"),
actionButton("plus", "+1"),
br(),
textOutput("value")
)
# The comments below show the equivalent logic using reactiveValues()
server <- function(input, output, session) {
value <- reactiveVal(0) # rv <- reactiveValues(value = 0)
observeEvent(input$minus, {
newValue <- value() - 1 # newValue <- rv$value - 1
value(newValue) # rv$value <- newValue
})
observeEvent(input$plus, {
newValue <- value() + 1 # newValue <- rv$value + 1
value(newValue) # rv$value <- newValue
})
output$value <- renderText({
value() # rv$value
})
}
shinyApp(ui, server)
}
which I copied from RStudio, and got this error: Error in server(...) : could not find function "reactiveVal"
I copied some coding from what appears to be the function on git but still can't get it to work.
Thanks for any support,
gwynn