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.