I am looking for a way to change a variable, which has been initialized outside of the reactivity context in a shiny app.
Meaning: I have two variables which I need to set, depending on what happens in the shiny app, to TRUE or FALSE.
That needs to be done from an an reactive function.
Example:
a <- FALSE
c <- FALSE
observeEvent(input$test, { #this triggers c to change to TRUE
    a <- FALSE
    c <- TRUE
)}
Some user clicks on the button with the label test
> c
> TRUE
                If I understand your question correctly (you cannot update c inside the observeEvent function), you need to put your c variable in a reactive and change it inside the observeEvent:
variables = reactiveValues(a = FALSE, c = FALSE)
observeEvent(input$test, {
    variables$a = FALSE
    variables$c = TRUE
})
Then you can use variables$c in your code, and anything depending on variables will be updated if you press the button (e.g. a plot).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With