# What is R? How do I use it?

R acts as an alternative to traditional statistical packages such as SPSS, SAS, and Stata such that it is an extensible, open-source language and computing environment for Windows, Macintosh, UNIX, and Linux platforms. Such software allows for the user to freely distribute, study, change, and improve the software under the Free Software Foundation's GNU General Public License. It is a free implementation of the S programming language, which was originally created and distributed by Bell Labs. However, most code written in S will run successfully in the R environment. R performs a wide variety of basic to advanced statistical and graphical techniques at little to no cost to the user. These advantages over other statistical software encourage the growing use of R in cutting edge social science research.

### Where can I obtain R?

Installation files for Windows, Mac, and Linux can be found at the website for the Comprehensive R Archive Network, http://cran.r-project.org/. The site also contains documentation for downloading and installing the software on different operating systems. There is no cost for downloading and using R.

### Where can I find more information on R?

#### Books

Braun, W. and Murdoch, D. (2007). A First Course in Statistical Programming with R. Cambridge, MA: Cambridge University Press.

Chambers, J. M. (1998). Programming with Data: A Guide to the S Language. Murray Hill, NJ: Bell Laboratories.

Dalgaard, P. (2008). Introductory Statistics with R (2nd edition). New York: Springer.

Everitt, B., and Hothorn, T. (2006). A Handbook of Statistical Analyses Using R. Boca Raton, FL: Chapman & Hall/CRC.

Faraway, J. J. (2005). Linear Models with R. Boca Raton, FL: Chapman & Hall/CRC.

Faraway, J. J. (2006). Extending the Linear Model with R: Generalized Linear, Mixed Effects and Nonparametric Regression Models. Boca Raton, FL: Chapman & Hall/CRC.

Fox, J. (2002). An R and S-Plus Companion to Applied Regression. Thousand Oaks, CA : Sage Publications.

Muenchen, R. A. (2009). R for SAS and SPSS Users. Springer Series in Statistics and Computing. New York: Springer.

Murrell, P. (2005). R Graphics. Boca Raton, FL: Chapman & Hall/CRC.

Pinheiro, J. C. and Bates, D. M. (2004). Mixed Effects Models in S and S-Plus. New York: Springer.

Spector, P. (2000). Data Manipulation with R. New York: Springer.

Venables, W. N., and Ripley, B. D. (2002). Modern Applied Statistics with S. Fourth Edition. New York: Springer.

Zuur, A. F., Ieno, E. N., and Meesters, E. H. W. G. (to be published 2009). A Beginner's Guide to R. Use R. New York: Springer.

#### Web Resources

The Omega Project for Statistical Computing

The R Project for Statistical Computing

#### Seminal Journal article

Ihaka, R., and Gentleman, R. (1996). R: A language for data analysis and graphics. Journal of Computational and Graphical Statistics, 5(3):299-314.

### References:

## How do I read ICPSR data into R?

We have a brief tutorial available on how to read data into R.

## Can I use R without having to learn the details of the R language?

Yes (at least for the basics), there are a number of "front ends" that have been constructed in order to make it easier for users to interact with the R statistical computing environment. For example, a graphical user interface (or "GUI") allows the analyst to carry out data analysis tasks by selecting items from menus and lists, rather than entering commands.

One such GUI is the *R Commander*, written by John Fox. The *R Commander* is accessed by installing and loading the *Rcmdr* package within R. The R Commander provides an easy-to-use, menu-based system for loading data into R, manipulating data values, performing statistical analyses, creating graphical displays, and carrying out diagnostic tests on statistical models. Documentation for the R Commander is available on John Fox's website and in the following paper:

Fox, John. 2005. "The R Commander: A Basic-Statistics Graphical User Interface to R." Journal of Statistical Software 14(9).

There are several other GUI systems, in addition to the *R Commander*, for interacting with R. A useful discussion of R and GUIs, along with a list of current GUI projects for R is available.

The advantage provided by the *R Commander* or another GUI is that the user does not need to learn a language in order to carry out his or her analysis. Instead, each step is taken by making one or more selections from a menu of available options. The disadvantage of interacting with the R environment through a GUI is that the course of the analysis is limited to those actions that have been programmed into the GUI. Thus, one could argue that using a GUI removes much of the flexibility that is inherent in the R environment.

In order to overcome the preceding limitation, the *R Commander* and most other GUIs allow the user to employ both methods of interacting with the environment within a single R session. For example, one could invoke the *R Commander*, and use its GUI to read the contents of an external file and create an R data frame. For many types of analyses, other features of the *R Commander* could be used to estimate model parameters, construct graphical displays, and so on. But, if the user wanted to carry out a task that is not available in the *R Commander* (e.g., a multidimensional scaling analysis), then the data frame created in the GUI could still be treated like any other currently defined R object (say as an argument to a function or the target of an assignment) on the R command line. In this manner, a user could exploit the advantages of both the GUI and the command-line interface.