Though an 'old guy' in unix world, I've little experience with RStudioServer and R, acting here as an 'admin' for a shared server for statisticians on a cancer research study. And my unix 'admin' experience is ... rusty !
I have a list of about 100 packages used by our senior Statistician on the study, and would prefer to load (AND UPDATE PERIODICALLY) them from an R shell directly (vs inside RStudioServer). I think using the default system location to add them ( /opt/R/4.2.0/lib/R/library) is the way to go. The RStudioServer setup, i think, still allows user to load their own (which is fine by me), but I thought having a default group loaded per our Statistician's ask... is wise.
The commands I was given which load these packages have the syntax below (only including a few lines of the 90 line .sh script) - they seem to install if the package doesnt already exist.
SO... I wonder if I set an environment (or ?) variable properly, then run R (as root ?), issue all these commands... would the libraries be placed appropriately in the library folder(for 4.2) that I set in the env variable ? (this example, it'd be /opt/R/4.2.0/lib/R/library ) ??
Since this is Linux, we would want sources when approprite, which i THINK is default loading for this os.
If there is a better/easier way to do this, I'm all ears !
Thanks in advance for any thoughts you have...
r
if (!requireNamespace("markdown", quietly = TRUE)) install.packages("markdown")
if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools")
# graphical/table output
if (!requireNamespace("igraph", quietly = TRUE)) install.packages("igraph")
if (!requireNamespace("ggplot2", quietly = TRUE)) install.packages("ggplot2")
# advanced regression
if (!requireNamespace("glmnet", quietly = TRUE)) install.packages("glmnet")
if (!requireNamespace("sm", quietly = TRUE)) install.packages("sm")
environment: CentOS 8 RStudio Server 1.4.1717-3 R 4.2 (4.1.3, 3.6.3)