An R scratchboard

Some of the posts in this blog will be interactive, encouraging you to use R to explore data. You’ll be guided through that process when required. But in the meantime this page contains a scratchboard you can use for trying things out in R any time you feel like it. Just toggle to ‘R console’ at the top of the window and then use any R commands that you like. Or, write your commands in the script.R window, hit the ‘Run’ button and then toggle to the ‘R console’ window to see the results. Any graphs that you make will be drawn in a separate ‘Plots’ window.

 

Please use this page both to familiarise yourself with this interface to R, as well as experimenting with any R commands that you’d like to try.

 

 

Below is a short video showing how to use the scratchboard either by typing a series of R commands into the script.R window, and then hitting the ‘Run’ button; or, more interactively, by toggling to the R console window and typing the commands one line at a time. In both cases the commands are executed in the R console window, with plots being sent to a separate plot window.

 

The example in the video is based on a standard set of data included in R called Nile, which is annual flow rates of the river Nile.  Technically this is what’s known as a time series, and since R is an object-based language, a command like plot produces the most sensible plot for data of this type: in this case a plot of the annual river flow against the year.

 

A list of all the standard datasets in R can be found here. In future posts to the blog we will enter our own data and analyse them. There are plenty of online resources if you want to learn some of the basics of R; for example, these notes give a simple description with examples of some of the most important aspects.