Getting Started in R

By Liz Law

So you want to learn R, but just don’t know where to start…


The R website is your friend:

The index on the left has several points of interest:

  • Manuals & Contributed – these pages have many “introduction to R” and quick reference things in English and Belorussian (among other languages… )
  • Task Views – this links to several pages describing a whole bunch of “packages” that are used for different fields. For example, Environmentrics (ecology), Econometrics (economics), Spatial, Optimization programming, Multivariate stats, Graphs, basically all the things you could imagine.

I use RStudio – I find it a really nice way of viewing code, history, workspace, plots, help etc on the one page. But there are a number of other gui interfaces, they can be found on the R website here

I found “Quick-R” a useful reference page to start as well, it explains things cleanly with code examples. Another useful way to start, particularly if you are also rusty at basic stats, is to go through Crawley’s “Introduction to Statistics Using R” (note, full text is available online through the UQ library).

All packages will have a pdf manual, generally readily found by searching for “r cran” and the package name. However, it is always worth searching if the package also has other documentation (often called a vignette) or a website which goes through worked examples of the process. These can be more useful, particularly when you are first starting! Generally all packages come with datasets that can be used for the examples, these can be useful to see what format inputs should be in.

A call in R of “?” and then the function of interest (for example “?read.table”) will bring up help for that particular function.

Generally though, once you have the basics, any search with “r cran” and the particular method or test you want to perform (for example, “r cran glmm”), or error you find presented to you (for example “r cran Convergence failure”)  will deliver some more or less useful results, often from blogs or forums. Like any blogs/forums you sometimes need to wade through several links to find something understandable and useful.


A nice place to get inspiration: graphs can be searched with keyword, and all code is provided. Else, just search for “r cran” and the name of the graph you want to produce (can be easy searching google images rather than google web).

Some useful functions to get started…

I generally import data as csv files as these use to be one of the most reliable formats (read.csv(“file location”)), though now other formats are equally as good. For rasters, can import straight from esri grids, though have less options to export. Dbf files can be read in using the package “foreign”.

To check data is imported properly:

head(x), tail(x), str(x), class(x), summary(x), table(x), plot(x)…. where x is your data object.

But really, there are so many resources out there now to make learning R easy, and nothing beats practice!

So explore and have fun!