Wednesday, October 7, 2009

Day 1

Start by installing R. R is an open source platform for statistical computing. The R project is hosted at the R Project site. Download R for your platform. The current version is 2.9.2. But pretty much any version should work.

Pick up a cup of coffee while you are waiting for the file to download.

Install R by following the instructions. Usually this means little more than clicking on the disk image and running the installer.

Test the installation. You can think of R as a gigantic calculator. Start up R and run a few tests to see that your install worked:

> 2+2
[1] 4
> exp(-2)
[1] 0.1353353
>
The > is the prompt, and the numbers in parentheses in the answer help you find your way through the result. Often, the results are given as a vector as in the examples above.

Next, install igraph. igraph is an R package for social network analysis. Many packages have been written for R for all kinds of purposes. You can find most of them on CRAN, the R archive. Here is a Canadian CRAN mirror site: http://cran.stat.sfu.ca. Select the Package Installer from the Packages & Data menu, click Get List and enter "igraph" in the search box. Select igraph and hit Install Selected. The current version of igraph is 0.5.2-2.

If you were successful, you should see something like the following:

trying URL 'http://probability.ca/cran/bin/macosx/universal/contrib/2.9/igraph_0.5.2-2.tgz'
Content type 'application/x-gzip' length 2401199 bytes (2.3 Mb)
opened URL
==================================================
downloaded 2.3 Mb

The downloaded packages are in
/var/folders/A6/A6HuYMhtGsSKIXTAuzxo9U+++TI/-Tmp-//RtmpX7GvKg/downloaded_packages

To verify the installation, load the igraph library and search for the help page on an igraph function. Something like this:

> library(igraph)
> help(degree)
>

Enough for today. Give yourself a pat on the back.

No comments:

Post a Comment