r - How to reload a shiny application -


i've developed shiny application (using shinydashboard) , i'd save "session" (by session mean values of input , data load user). want save in .rdata file , able restart app, load .rdata file , data , input defined user , hence output...

is there way such thing shiny ?

thanks

i tried save r environment in .rdata file using save.imagebut did not work out. worked though using save , load functions store , restore .rda files.

as naming use timestamp maybe differentiate between users.

edit (example)

okay, in app there 2 selectinput elements: first, , second. if of these change, values of these inputs assigned 2 variables: first_var , second_var saved test.rda file. if file exists variables loaded session.

so basically, if run app first, whenever change inputs, saved .rda file. if exit , rerun app, variables loaded, , set selected value of inputs.

library(shiny) if(file.exists("test.rda")) load("test.rda")  ui <- fluidpage(   selectinput("first",               label = "first",               choices = c("value a", "value b", "value c"),               selected = ifelse(exists("first_var"), first_var, "value a")   ),   selectinput("second",               label = "second",               choices = c("value d", "value e", "value f"),               selected = ifelse(exists("second_var"), second_var, "value d")   ) )  server <- function(input, output, session){   observe({     first_var <- input$first     second_var <- input$second     save(file = "test.rda", list = c("first_var", "second_var"))   }) }  shinyapp(ui, server) 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -