How to load custom environment data

I am trying to run my own Shiny app through ShinyProxy. I have a file in my application folder called BaseEnvironment.RData which is an environment file containing my data. I assume I am supposed to load this during initialization through my DockerFile. I have this in my DockerFile

load('BaseEnvironment.RData')

but I am getting the following:

Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
Calls: load -> readChar
In addition: Warning message:
In readChar(con, 5L, useBytes = TRUE) :
cannot open compressed file ‘BaseEnvironment.RData’, probable reason 'No such file or directory’
Execution halted

It seems I don’t know how to properly reference data dependencies/files. In the template apps, the data seems to be packaged up in the libraries. How should this be handled in my case, where the data should be coming from files on my server?

I can run setwd on certain folders, but not others. It also doesn’t seem like a permissions issue because I have done chmod 777 and still no avail… How do I load an environment file at the start of loading the app/container??

Hi @Ala_Arab,

Please have a look at http://www.shinyproxy.io/deploying-apps/.
To make a file available inside docker container it needs to be included using a COPY command in your Dockerfile. For the example linked above, the commands

COPY euler /root/euler
COPY Rprofile.site /usr/lib/R/etc/

will make Rprofile.site file and euler folder available inside docker at /root/euler and /usr/lib/R/etc correspondingly.

Note that you need to specify location relative to the location of the Dockerfile. See also folder structure of the example in the repository https://github.com/openanalytics/shinyproxy-template.

Thank you mnazarov. I was able to get this working by putting this line at the start of my server.R file.

2 Likes