14 November 2019

Setting up R - the basics

by Zubair Abid

Documenting my installation procedure for R on Arch Linux, so it can be more easily reproduced with less haphazard googling the next time I try this.

Reasons for installing R

Tutorials referred to


Refer to Archwiki’s entry on R to see the exact specifics on configuration, but my main takeaway is this:


R system installation

Decided to use pacman, because why not. Is the preferred method.

sudo pacman -S r gcc-fortran

You can now access the terminal by typing R into the terminal.


I don’t usually use IDEs, but everyone seems to be recommending RStudio, so we may as well. I believe you can install it from inside R itself, but I used the package available on the AUR.

yay -S rstudio-desktop-bin


For installing packages in R, we need to install the tk package.

sudo pacman -S tk

Packages in R

You could use pacman to install R packages. As a rule, I tend to avoid system level package installations for languages (see: python, JS, etc) when possible, so this goes out of the window.

Now, the suggested method is to go to the R terminal and install.packages(package_name), but on its own it has the same problem as the method above (for me anyway), just like pip install without virtualenvs - and that is the lack of a virtualenv. I’m using Packrat to manage the packages. This walkthrough is great.

(Inside the R command line interface)


… and that’s about it. More details on packrat itself are available at the walkthrough provided.

Packrat with R-Studio

Since I have RStudio > 0.98, it’s inbuilt for me. Check out this link for more details.

tags: R - configuration - setup
<-- Back