R is a free software environment for statistical computing and graphics (http://www.r-project.org/).
Some external packages may require to be compile in Fortran as well, so installing the can be a good idea
Please refer to Initialization at Start of an R Session to get a detailed understanding of startup process.
The home directory of the
R installation is
usr/bin/R. Base packages are found in
usr/bin/R/library/base and site configuration files in
/etc/R/. Aspects of the Locale are accessed by the functions
Sys.localeconv within the
R session. Locales will be the one defined in your system.
To start a
R session, open your terminal and type this command:
help(startup) to read the documentation about system file configuration,
help() for the on-line help,
help.start() for the HTML browser interface to help,
demo() for some demos and
q() to close the session and quit.
When closing the session, you will be prompted :
Save workspace Image ?[y/n/c]. The workspace is your current working environment and include any user-defined objects. The saved image is stored in
.RData and will be automatically reloaded the next time
R is started. You can manually save the workspace at any time in the session with the
Rcan be confusing when it comes to Environment Variables, as they are large and duplicated following the site or user sides. Most important variables can be found on Environment Variables
RDocumentation. At startup,
Rsearch at early stage for site and user
Renvironfiles to process for setting environment variables. The name of the site file is the one pointed to by the environment variable
R_ENVIRON, given when running the
The name of the user file can be specified by the
R_ENVIRON_USER environment variable.
If you don't specify any file,
R will automatically read
.Renviron in your home directory if there is one. As this file is read at start-up early stage, you can write a lot of initialization informations in it using the R language syntax. The style you will use to declare your variables will follow the name=value scheme:
Lines can be either commented starting with # or in the above mentioned style.
Most useful Environment Variables you want to use are the following ones:
To see a list of your current variables, run
options within your
Installing R packages
There are many add-on
R packages, which can be browsed on The R Website.. They can be installed from within
R using the
R can install its packages locally as per user local settings or system wide.
R session, run this command to check that your user library exists and is set correctly:
Installation within your
R session is the safest way and won't conflict with the pacman package management, but there is another method to install packages. Run the following command in your terminal:
$ R CMD INSTALL -l $R_LIBS_USER pkg1 pkg2 ...
Upgrading R packages
Or when you also need to rebuild packages which were built for an older version:
Adding a graphical frontend to R
The linux version of R does not include a graphical user interface. However, third-party user interfaces for R are available, such as R commander and RKWard.
R Commander frontend
R Commander is a popular user interface to R. There is no Arch linux package available to install R commander, but it is an R package so it can be installed easily from within R. R Commander requires Tk:
# pacman -S tk
To install R Commander, run 'R' from the command line. Then type:
> install.packages("Rcmdr", dependencies=TRUE)
This can take some time.
You can then start R Commander from within R using the library command:
RKWard is an open-source frontend which allows for data import and browsing as well as running common statistical tests and plots. You can install AUR.AUR from
RStudio an open-source R IDE. It includes many modern conveniences such as parentheses matching, tab-completion, tool-tip help popups, and a spreadsheet-like data viewer.
Install AUR.AUR (binary version from the Rstudio project website) or AUR (development version) from
The R library path is often configured with the R_LIBS environment variable. RStudio ignores this, so the user must set R_LIBS_USER in
~/.Renviron, as documented above.