Blog Archives

Programming with R – Processing Football League Data Part I

November 23, 2010
By

In this post we will make use of football results data from the football-data.co.uk website to demonstrate creating functions in R to automate a series of standard operations that would be required for results data from various leagues and divisions. The first step is to consider what control options should be available as part of the

Read more »

Programming with R – Checking Data Types

November 13, 2010
By

There are a number of useful functions in R that test the variable type or convert between different variable types. These can be used to validate function input to ensure that sensible answers are returned from a function or to ensure that the function doesn’t fail. Following on from a previous post on a simple function

Read more »

Programming with R – Returning Information as a List

November 1, 2010
By

In previous posts (here and here) we created a simple function that returns a single numeric value. In some situations it may be more useful to return a more flexible data type, such as a list object, to provide more information about the calculations that have been performed. We can extend our previous function by changing

Read more »

Programming with R – Checking Function Arguments

October 24, 2010
By

In a previous post we considered writing a simple function to calculate the volume of a cylinder by specifying the height and radius of the cylinder. The function did not have any checking of the validity of the function arguments which we will consider in this post. R has various functions that we can use to

Read more »

Programming with R – Function Basics

October 20, 2010
By

One of the benefits of using R for statistical analysis is the programming language which allows users to define their own functions, which is particularly useful for analysis that needs to be repeated. For example, a monthly output from a database may be provided in a pre-determined format and we might be interested in running

Read more »

Plotting Time Series data using ggplot2

September 30, 2010
By
Plotting Time Series data using ggplot2

There are various ways to plot data that is represented by a time series in R. The ggplot2 package has scales that can handle dates reasonably easily. Fast Tube by Casper As an example consider a data set on the number of views of the you tube channel ramstatvid. A short snippet of the data is shown

Read more »

Classification Trees using the rpart function

September 21, 2010
By
Classification Trees using the rpart function

In a previous post on classification trees we considered using the tree package to fit a classification tree to data divided into known classes. In this post we will look at the alternative function rpart that is available within the base R distribution. Fast Tube by Casper A classification tree can be fitted using the rpart function

Read more »

Classification Trees

September 18, 2010
By
Classification Trees

Decision trees are applied to situation where data is divided into groups rather than investigating a numerical response and its relationship to a set of descriptor variables. There are various implementations of classification trees in R and the some commonly used functions are rpart and tree. Fast Tube by Casper To illustrate the use of the tree

Read more »

Creating a Presentation with LaTeX Beamer – Frame Transitions

September 4, 2010
By
Creating a Presentation with LaTeX Beamer – Frame Transitions

Transitions are often used in presentations to break up the presentation and to keep the audience awake, but often the outcome is irritation/distraction with text or other objects flying on or off the screen from different directions. As such they should be used sparingly if at all in a talk. LaTeX beamer has a simple

Read more »

Creating a Presentation with LaTeX Beamer – Using Overlays

August 25, 2010
By
Creating a Presentation with LaTeX Beamer – Using Overlays

Overlays can be used in a LaTeX beamer presentation to reveal parts of a slide sequentially, which can be a useful way of imparting information to your audience. There are a number of different ways that overlays can be created depending on the sophistication required in the presentation. Fast Tube by Casper The \pause command is the

Read more »