R by example

Basics

Reading files

Graphs

Probability and statistics

Regression

Time-series analysis

All these examples in one tarfile.

Outright non-working code is unlikely, though occasionally my fingers fumble or code-rot occurs. More importantly, I am not an R guru. So I will always be happy if you alert me to mistakes or improvements. Please do also send me requests for things that ought to be on this page and aren't (ideally with the code!).

Other useful materials

Suggestions for learning R

The R project is at http://www.r-project.org : In particular, see the `other docs' there.

Over and above the strong set of functions that you get in `off the shelf' R, there is a concept like CPAN (of the perl world) or CTAN (of the tex world), where there is a large, well-organised collection of 3rd party software, written by people all over the world. This is called `CRAN' for Comprehensive R Archive Network. You will be amazed at the quality and comprehensiveness of the code out there.

The dynamism of R and of the surrounding 3rd party packages has thrown up the need for a newsletter, R News. You should make it a point to look hard at back issues. The standard online documents associated with R tend to be reference manuals targeting someone who already knows quite a bit. The articles in R News are very valuable in taking you from scratch to understanding R. As an example, you can certainly learn using the online documents on the boot() package, by saying:

library(help=boot) library(boot) ?boot

But you will learn a lot more by reading the article Resampling Methods in R: The boot package by Angelo J. Canty, which appeared in the December 2002 issue of R News.

Ajay Shah, 2005