Installing RStan on HPC cluster

This took me some time to make it work, so I’ll write the details here for the benefit of my future self and anyone else facing similar issues. To run R in the Apocrita cluster (which runs CentOS 7) first load the modules module load R module load gcc (gcc is required to compile the packages from source.) Before starting you should make sure that you don’t have any previous installation of RStan in your system.