Programs/Environments for Quantitative Research

Most kinds of research involve creating and exploring "data". Researchers use many computational tools in this process: there are spreadsheet programs like Excel; programming languages like Matlab, Python, or Java; and statistical packages like SPSS, SAS, Stata, and R.

In this seminar, we'll provide a basic foundation in the use of R, which is a language and environment for statistical computing and graphics. Reasons to choose R: it's very widely used and offers a wide variety of capabilities; it's programmable and easy to extend; it's free.

There will be two things for you to learn:

1. How to understand and apply various data analysis techniques;
2. How to use R to do this.

Depending on your interests and goals, you will probably want to become skilled in the use of some other computational tools as well. We'll spend some time surveying this landscape, and discussing what options might suit your individual case.

This assignment will get you set up to explore and analyze data in R.

Installing and using R

If you have your own computer, use this page to download and install R for Windows, Mac OS X, or Linux.

If you want or need to use a public-access computer (e.g. in one of the residential computer labs), contact me.

After you've installed R, run it. You should see a console window that looks more or less like this:

The R prompt '> ' invites you to type commands, e.g.

> 2+2
[1] 4


> sqrt(2)
[1] 1.414214

As you'll see, you can do much more complicated and interesting things almost equally easily.

Two more things before you're ready to start seriously learning to use R.

One is the Editor window. You can use the

File>>New Document

menu to start a new R script, or

File>>Open Document

to open an existing one. This allows you to create, edit, and apply R scripts and functions.

Second, R has a notion of "working directory" or "working folder", which is where it will look for new data files that you ask it to load, scripts you ask it to execute, etc. You can check or set the working directory from the R command line, and you can also use the menu item

Misc>>Change Working Directory

See if you can do this much to create a script that does something trivial, like

X = sqrt(2)

and save it in a file "silly.R".

Now if you execute this file, via the command


(or using the menu item Edit>>Execute)

then in the Console window, X will have the value that your script has assigned to it.

> X
[1] 1.414214

Now you're ready to start learning to use R. If the steps so far were easy for you, or you're feeling generally enthusiastic, you can start exploring one of the many online R tutorials, e.g. the first few chapters of this one.