Re: How to load Rdata file only once in ShinyApp

38 views
Skip to first unread message

Corey Bishop

unread,
Mar 10, 2021, 9:30:14 AM3/10/21
to chas, Shiny - Web Framework for R

On Wed, Mar 10, 2021 at 7:21 AM chas <meha...@gmail.com> wrote:

Hi,


I have deployed a shinyapp which uses a .Rdata file of ~700Mb.The Rdata file is loaded in server-inputdata.R file and the server.R file looks like as shown below:

options(shiny.maxRequestSize = 100*1024^2) 
source("helpers.R") 
source("server-inputdata.R",local = TRUE) 

shinyServer(function(input, output,session) { 
source("server2.R",local = TRUE) 
source("server3.R",local = TRUE) 
 })

Here, server2.R and server3.R has visualization code which uses the data loaded from .Rdata file in server-inputdata.R

Whenever the app is loaded, the Rdata file is getting loaded for each user. Could someone help how to load the data only once to provide immediate access for the second user onwards.

I have also tried source("server-inputdata.R",local = FALSE)  in the above code, which did not work.

Here is the code in server-inputdata.R

inputDataReactive <- reactive({ 
load('04.Rdata') 
return(list("data"=data_results, "data_results_table"=data_results_table))
 print("uploaded data") 
})

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/535a3949-59ba-44a4-985a-4dca5a7a0c81n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages