Programming with R – Checking Data Types

November 13th, 2010

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. Read the rest of this entry »

Programming with R – Returning Information as a List

November 2nd, 2010

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. Read the rest of this entry »

Programming with R – Checking Function Arguments

October 25th, 2010

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. Read the rest of this entry »

Programming with R – Function Basics

October 20th, 2010

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 the same initial analysis on the data. Read the rest of this entry »

Plotting Time Series data using ggplot2

September 30th, 2010

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. Read the rest of this entry »

Charting the performance of cricket all-rounders – IT Botham

August 16th, 2010

Cricket is a sport that generates a large volume of performance data and corresponding debate about the relative qualities of various players over their careers and in relation to their contemporaries. The cricinfo website has an extensive database of statistics for professional cricketers that can be searched to access the information in various formats. Read the rest of this entry »

Useful functions for data frames

August 9th, 2010

The R software system is primarily command line based so when there are large sets of data it is not easy to browse the data frames. There are various useful functions for working with data frames. Read the rest of this entry »

R Commander – two-way analysis of variance

June 25th, 2010

Two way analysis of variance models can be fitted to data using the R Commander GUI. The general approach is similar to fitting the other types of model in R Commander described in previous posts. Read the rest of this entry »

R Commander – one-way analysis of variance

June 25th, 2010

One way analysis of variance models can be fitted to data using the R Commander GUI. The general approach is similar to fitting the other types of model in R Commander described in previous posts. Read the rest of this entry »

R Commander – logistic regression

June 23rd, 2010

We can use the R Commander GUI to fit logistic regression models with one or more explanatory variables. There are also facilities to plot data and consider model diagnostics. The same series of menus as for linear models are used to fit a logistic regression model. Read the rest of this entry »

Statistics Books