Pages (Desktop)

Pages (Mobile)

Supergrid - add custom grids to base R plots

SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID SUPERGRID

Supergrid - a new function to easily add grids to base R plots with major and minor grid lines, fully customisable and pseudo theming for re-use, super easy to use, read on to learn more!


Supergrid - creating and using themes

In part 2 of this guide looking at supergrid() - a new function to easily add grids to base R plots with major and minor grid lines - this part shows you how to create and add themes to re-use the same styles for different plots. Read on to learn more!


Better Biplots for Principal Component Analysis

Principal component analysis (pca) is a great dimension reduction method to reduce large datasets to a smaller set, keeping the key, or principal components. R offers functions to carry out pca with ease, but creating good looking biplots in R can be quite involved, or require additional packages.

I've written a new, better biplot function, which makes creating beautiful looking biplots a breeze. And, its all written in base R, so does not require any additional packages to be installed. Just load the script and start plotting!

PC1 (73%) PC2 (22.9%) -3 -2 -1 0 1 2 3 -3 -2 -1 0 1 2 3 Species setosa versicolor virginica -1.0 -0.5 0.0 0.5 1.0 -1.0 -0.5 0.0 0.5 1.0 Sepal.Length Sepal.Width Petal.Length Petal.Width


Loops in R: Nested loops

Programming loops are a way to repeat blocks of code to perform the same task over and over again. R offers the same functionality to perform repetitive tasks, allowing to write less and more efficient code.

This guide follows on from my introduction to loops guide, and shows you have to use nested loops in R. A nested loop is a loop within a loop.


BES Masterclass: Using R for mapping and spatial analysis

Today I presented at the British Ecological Society Palaeoecology Group "Masterclass in R" seminar series on using R for mapping and spatial analysis.

If you couldn't make the presentation and would like to see what I spoke about, as well as access the full R code, read more for details!


Fixing the default plot window on Linux for high DPI displays

Running R on Linux with a high-DPI display and finding that the default plot window is too small and looks terrible?

Click read more to find out how to fix it!


Introduction to loops in R

Programming loops are a way to repeat blocks of code to perform the same task over and over again. R offers the same functionality to perform repetitive tasks, allowing to write less and more efficient code.

This guide introduces you to loops in R, explains how to write them, including for loops and while loops, and some best practice for writing efficient loops. I'll also take a look at vectorization in R, explaining what it is and why you should used vectorized functions where possible. This guide will introduce you to the basics of programming and automating tasks in R.


Getting started with R

Ever wanted to try R, but wasn't sure where to start? Or perhaps you are unsure of what R is and what it can do?

New for 2021, I have completely rewritten, revised and greatly expanded my introduction to R guide. Additionally, I have added additional guides for importing data into R, and to give an overview of R graphics and creating plots (see below).

The introduction guide is now much more comprehensive, and includes everything you need to get started with R! Check them out:

Part 1: Introduction to R An introduction to R - what is R, where to get R, how to get started using R, a look at objects and functions, an overview of data structures, and getting started with manipulating data.
Part 2: Importing data into R This guide shows you how to import your existing data into R from .csv or Excel files.
Part 3: An overview of graphics in R This guide gives you an overview of some of the graphical capabilities of base R to produce high quality plots.


Getting started with R: Importing data into R

In the second part of this expanded guide series introducing you to R, this guide shows you how to import data into R from csv files and Excel spreadsheets.

Of course, R can import many other data types, but these two are very common and will get you started!


Getting started with R: An overview of graphics in R

In the final part of this expanded guide series introducing you to R, this guide gives you an overview of the graphics systems in R, and gets you started creating plots using base graphics.