Pages (Desktop)

Pages (Mobile)

Useful functions for manipulating text in R

R has some really cool little features to make life easier. A couple of really useful features for dealing with long text or character strings are abbreviate() and strtrim(). The first will automatically abbreviate character strings to a specified number of letters, and the second will trim a long character string to a specified number of letters. These functions can be really useful if you need to shorten text - for example, in plot axes or legends.

This quick guide will show you how to use both of these functions in R, and also take a look at paste() for further text manipulation.


Quick guide to annotating plots in R

R has powerful graphical capabilities, and its possible to create almost any kind of graph, chart or plot. It also has powerful annotation options, allowing you to write and draw all over your plot, using labels, shapes, highlighting, and more.

You might have previously created plots in R, and annotated them using a different graphic program (e.g. Photoshop, Corel Draw etc.). But, you could just do it all in R! This guide will show you some of the ways in which you can scribble on your plots, which can be useful for keeping notes, or to highlight certain features of your data...


Principal Components Analysis (PCA) in R - Part 2

In the second part of my guide for principal components analysis (PCA) in R, I additionally cover loadings plots, adding convex hulls to your biplots, more customisation options, and show you some more examples of PCA biplots created using R's base functionality...