RStudio Server is fully compatible with Microsoft R. However, some Microsoft R installations set important environment variables such as CLASSPATH and LD_LIBRARY_PATH in the R script itself (i.e. in /usr/bin/R). Since RStudio Server does not run that script, those environment variables won't be set in RStudio Server R sessions.
To forward the environment variables to RStudio Workbench (previously RStudio Server Pro), follow these steps:
- Run Microsoft R from the command line, and then exit. Microsoft R creates a file in your home directory called .RevoHadoopEnvVars.site with the correct environment variables.
- Copy the file from your home directory to /etc/rstudio/RevoHadoopEnvVars.site.
- Add (or amend) the file /etc/rstudio/rsession-profile with the following content (adjusting the paths to suit your environment):
#!/bin/bash
SCRIPT_DIR=/opt/cloudera/parcels/MRO-8.0.5/lib64/R/bin
source /etc/rstudio/RevoHadoopEnvVars.site
source /opt/cloudera/parcels/MRO-8.0.5/lib64/R/bin/Revo-init
If you're not using RStudio Workbench, you can also set the necessary environment variables by creating a file called Renviron.site. Details on where this file can be placed and its syntax are described in the R help topic Initialization at Start of an R Session.
Comments