Access file outside project directory after publishing dashboard to RSConnect

Hi Team,

I have a Shiny dashboard and it is published to RSConnect. But some of my files are outside the project directory and the paths are referring to that files, So I am not able to use or open the published dashboard. Even I am loading packages from a folder outside the project directory.So my dashboard is not opening in RSConnect.
Is there any way to publish the dashboard with files outside the project directory.It would we great if someone could help on the same.

Hi,

Can you explain why the files can't be in the directory? The reason this is needed, is because if you publish something, that project folder gets uploaded to the server and there it can only read uploaded files (e.g. in the project (sub)folder).

The only way around this (if you really can't have some data locally) is to have it accessible over the internet and load it with its URL. Another scenario is dedicated storage like SQL servers or cloud storage where you need authentication and login (often they have R packages) in order to access the data.

Example to get data over internet

test = read.csv("https://raw.githubusercontent.com/datapackage-examples/sample-csv/master/sample.csv", sep = ",", header = T)

Please elaborate if this is not helping :slight_smile:
PJ

1 Like

Thanks much. :slight_smile:
We are loading packages from a share path and lots of files from shared folder which cannot be moved to the directory. For the data files the option of SQL server will be a best alternative, but could you suggest an alternative to load packages from the share folder.

Hi,

I have no experience with RStudio connect, but if you like to use R packages, you either have them installed on there or on a specific shared path. Read this documentation for guidance.

Who is going to be using your app? Is it accessible to anyone over the internet, or just within your company? In the latter case, you can also explore getting access to shared data through a shared folder that's accessible over the intranet as a NAS. I'm sure this has to be set by the RSC admins, but it should be possible.

PJ

1 Like

Typically our recommendation for loading packages on RStudio Connect is to use a CRAN-like repository. You can set this up yourself with a file share (and packages like miniCRAN or drat), although the usual recommended practice is to go over HTTP with a webserver (apache or nginx, etc.), which is the standard CRAN uses. This has the advantage of making every package install happen via the install.packages("myinternalpackage") command, no matter where you are (development, Connect, etc.).

RStudio Package Manager is designed to be the "buy" solution to this part of the equation (in the "build" vs. "buy" dichotomy) and provides several tools for package management. Noteworthy for your case is the option to build packages automatically from a git (BitBucket, GitLab, GitHub, etc.) repository - kinda like your own "private" CRAN.

2 Likes

We've set up our own package server using minicran plus some additional code for archived pacakge versions.

Before that we also used the External package option - and installled those packages on the server's R installation (this seemed to cause some warnings during deployment but mostly worked) - see Packages.External on https://support.rstudio.com/hc/en-us/articles/226871467-Package-management-in-RStudio-Connect

2 Likes

Thank You , This is very helpful, I will try the steps methods mentioned above.