Original Catalan version

R for statistical analysis in Political and Social Sciences - Basic Notes


For any search related to R it is important to first take a look at the main page of the R-project http://www.r-project.org/. This is the main place to start looking for any documentation and help.

There is an important section in this project website: CRAN (Comprehensive R Archive Network). This is the place from where it is possible to get the source code of the program and the extensions available as packages. From there it is important to select a mirror near you.

R documentation is excellent. Once in the program, in front of the command line, some options are available:

> ?command                         # opens the help page of the concrete 'command'

> help.search("text-to-find")      # Will look for all commands that have some
                                   # strings related with "text-to-find"

> RSiteSearch("text")              # Open a browser and searches inside all R 
                                   # related sites for that concrete text

Nevertheless, if we are not able to solve our doubt, there are also at least three more places to look for:

In addition to that:

Recommended packages

Useful complementary tools

R console is not sometimes the most useful tool to work with it. The easiest solution is to work with a text editor, and copy and paste the commands, and so keep also a record of our syntax. However, this is not the "best" solution. There are two different applications that work parallel to R in order to facilitate its use: Emacs/XEmacs and Tinn-R.

Emacs / XEmacs i ESS

Very powerful text editors (emacs and XEmacs) that, along with ESS (Emacs Speaks Statistics) allow interaction with R and lots of other languages (stata amongst them).


Tinn-R Colorizes the syntax and allows to send it to R and lots of other useful stuff. Only available under Microsoft Windows (having Vim, Emacs, ESS, ... who needs it in the *NIX world?)


RStudio is a powerful integrated development environment for R.

Reference card (basic)

Reference card (pdf) of the most used commands.

Example scripts commented

Why you should use R?

Last, but not least, why should I use R if my university pays a licence of SPSS/Stata/other-program?

Without being exhaustive, here you have some arguments for using R for research and teaching in the social sciences:

Practical arguments

More arguments at Why use R?.

And a list of the signals that are sent when one chooses a software for data analysis: Statistics Softwrare Signal.

Ethical arguments

Apart from being a useful took, it is also a good tool.

Command line? But if we are in the mouse era!

There are also some reasons to prefer to work with the spartan R command line instead of doing in a mega-ultra-fancy interface that does everything with clicks.... (and without thinking at all)

However, if you prefer to work with a graphical user interface, R has currently different packages to work with:

Xavier Fernández i Marín - December 2004 (last update, march 2013), translation from the original Catalan version

Licensed under a Creative Commons License.