Alias for Command Line R

If you want to use R in a terminal and use the exact same version as the one shipped with Architect, you can (on GNU/Linux) define an alias in your bash configuration file .bashrc.

When you specify such an alias you need to include a number of environment variables (R_LIBS_SITE and R_LIBS_USER) to make sure that will put the Architect R libraries on the library path of your R session:

alias R='R_LIBS_SITE=/opt/architect/plugins/eu.openanalytics.architect.r.libs.rj.gtk.linux/libs R_LIBS_USER=~/.architect/workspace/.metadata/.r/eplugin-local-eu.openanalytics.r.server/user-library /opt/architect/plugins/eu.openanalytics.architect.r.server.gtk.linux/R/bin/R'

If you have set the alias correctly, you should see something along the following for the .libPaths():

> .libPaths()
[1] "/home/tverbeke/.architect/workspace/.metadata/.r/eplugin-local-eu.openanalytics.r.server/user-library"   
[2] "/opt/architect/plugins/eu.openanalytics.architect.r.libs.rj.gtk.linux.x86_64_1.3.0.202402232217/libs"    
[3] "/opt/architect/plugins/eu.openanalytics.architect.r.server.gtk.linux.x86_64_1.3.0.202402232217/R/library"

It is also possible to directly define the alias from an R session running inside Architect. To achieve this, run the following code in your Architect R session:

aliasCmd <- paste0("alias R='R_LIBS_SITE=",.Library.site," R_LIBS_USER=",.libPaths()[1]," ",Sys.which("R"),"'")
cat(aliasCmd, file = "~/.bashrc", append = TRUE)

Note: in the .libPaths() you will see paths with specific version numbers (e.g. 1.3.0.202402232217) whereas the alias includes paths without these version numbers. The reason is that Architect defines symbolic links that you can use in your alias to always point to the right directories, also when you upgrade Architect versions.