Is it possible get a value from the shiny app and the load in the Global Environment in running time?
I have a shiny app and for now, I can load a variable from the shiny app in the global environment but this only works when I close my shiny session.
You can run the example
ui <- fluidPage(
headerPanel("Example reactiveValues"),
mainPanel(
# input field
textInput("user_text", label = "Enter some text:", placeholder = "Please enter some text."),
actionButton("submit", label = "Submit"),
# display text output
textOutput("text"))
)
server <- function(input, output) {
# observe event for updating the reactiveValues
observeEvent(input$submit,
{
text_reactive$text <- input$user_text
#assign("data", text_reactive$text,envir=.GlobalEnv)
})
eventReactive(input$submit,{
assign("data", text_reactive$text,envir=.GlobalEnv)
})
# reactiveValues
text_reactive <- reactiveValues(
text = "No text has been submitted yet."
)
# text output
output$text <- renderText({
})
}
shinyApp(ui = ui, server = server)
But How can I load the variable load in the Global Env but without closing my shiny app?