How to Set up R/DataSHIELD Client Profiles¶
Following the possibility to have different R/DataSHIELD server profiles (see How to Set up R Server Profiles and How to Set up DataSHIELD Server Profiles), it may be necessary to have different R environment on the client side as well. This is mandatory in the case of DataSHIELD where a server-side package only works with a specific client-side package version.
This concept of R environment is covered by the renv R package which intends to provide isolated, portable and reproducible R projects. Using renv
gives full control of the user on its R exection environment, without depending on an IT infrastructure (different interfaces for different profiles).
In order to help with setting up such project, you can start with the DSProjectTemplate.
Adding a Dependency on an R Package from GitHub¶
As an example some of the DataSHIELD R packages are not available in the official CRAN repository. For R packages saved on GitHub you can use the following procedure to include a new dependency:
Note
- Run
renv::install()
to retrieve a specific version of a R package from GitHub; for examplerenv::install("neelsoumya/dsSurvivalClient@v1.0.0")
to install a released version of dsSurvivalClient - Edit your analysis script to make use of this package; for example
library(dsSurvivalClient)
- Run
renv::snapshot()
to register this package as part of your project environment
Removing a Dependency on an R Package¶
This is as simple as:
Note
- Edit your analysis script and remove the
library()
load statement of the package - Run
renv::snapshot()
to unregister this package from your project environment