Welcome to the support page for my book, *The Essential R Reference*.

Here you will find a Table of Contents and brief outline to help you see what’s included in each section of the book.

The book includes many examples and there is a file that you can download, which contains data used in these examples. This one file contains the example data sets you need for the whole book; it contains very few because I have tried to make all data fairly simple and short so that you can type it directly.

## Table of Contents

**An essential companion in your day-to-day conversations with R**

This book is organized in a topic-led, logical manner so that you can look for the kind of task that you want to carry out in R and find the command you need to carry out that task as easily as possible, even if you do not know the name of the command. The book is split into four grand themes:

These are hopefully self-explanatory, with the exception perhaps of “Utilities”; this covers the commands that did not fit easily into one of the other themes, particularly those relating to the programming side of R.

The outline covers each chapter/theme of the book.

## How this Book is structured

Each of the topics is also split into subtopics to help you navigate your way to the command(s) you need. Each command has an entry that is split into the following sections:

**Command Name**—Name of the command and a brief description of what it does.**Common Usage**—Illustrates how the command looks with commonly used options. Use this section as a memory-jogger; if you need fine details you can look in the “Command Parameters” section.**Related Commands**—A list of related commands along with the page numbers or a link to their entries so you can easily cross-reference.**Command Parameters**—Details of commonly used parameters for the command along with an explanation of what they do.**Examples**—Examples of the command in action. The section is set out in code style as if you had typed the commands from the keyboard yourself. You also see the resulting output that R produces (including graphical output).

Some commands are relevant to more than one theme or section; those commands either have a cross-reference and/or have an entry in each applicable place.

## Outline

The book is split into four grand themes.

### Theme 1: Data

**This theme is concerned with aspects of dealing with data. In particular:**

- Data types–Different kinds of data and converting one kind of data into another kind.
- Creating data–Commands for making data items from the keyboard.
- Importing data–Getting data from sources on disk.
- Saving data–How to save your work.
- Viewing data–Seeing what data you have in R.
- Summarizing data–Ways of summarizing data objects. Some of these commands will also appear in Theme 2: “Math and Statistics.”
- Distribution of data–Looking at different data distributions and the commands associated with them, including random numbers.

### Theme 2: Math and Statistics

**This theme covers the commands that deal with math and statistical routines:**

- Mathematical operations–Various math, including complex numbers, matrix math and trigonometry.
- Summary statistics–Summarizing data, some of these commands are also in Theme 1: “Data.”
- Differences tests–Statistical tests for differences in samples.
- Correlations and Associations–Including covariance and goodness of fit tests.
- Analysis of variance and linear modeling–Many of the commands associated with ANOVA and linear modeling can be pressed into service for other analyses.
- Miscellaneous analyses–Non-linear modeling, cluster analysis, time-series and ordination.

### Theme 3: Graphics

**This theme covers the graphical aspects of the R language:**

- Making graphs–How to create a wide variety of basic graphs.
- Adding to graphs–How to add various components to graphs, such as titles, additional points and shapes.
- Graphical parameters–How to embellish and alter the appearance of graphs. Including how to create multiple graphs in one window.

### Theme 4: Utilities

**This theme covers topics that do not easily fit into the other themes:**

- Installing–Notes on installing R and additional packages of R commands.
- Using R–Including accessing the help system, history of previously typed commands and managing packages.
- Programming–Commands that are used mostly in the production of custom functions and scripts. These can be thought of as the “tools” of the programming language.

## Example Data File

The book includes many examples and data used are included in the Essential.RData file. This one file contains the example data sets you need for the whole book; it contains very few because I have tried to make all data fairly simple and short so that you can type them directly.

### Get the example data

You can download that file by clicking on the link (Essential.RData). This one file contains all the example datasets you need for the whole book. Most examples are simple enough to type from the keyboard but some needed to be a bit longer and more complex. These data are included in the Essential.RData file for you to load into R, ready to use.

### Install the example data

Once you have the file on your computer you can load it into R by one of several methods:

- For Windows or Mac you can drag the RData file icon onto the R program icon; this will open R if it is not already running and load the data. If R is already open, the data will be appended to anything you already have in R otherwise only the data in the file will be loaded.

If you have Windows or Macintosh you can load the file using menu commands or use a command typed into R:

- For Windows use
**File > Load Workspace**, or type the following command in R:

load(file.choose())

- For Mac use
**Workspace > Load Workspace File**, or type the following command in R (same as in Windows):

load(file.choose())

- If you have Linux then you can use the
`load()`

command but must specify the filename (in quotes) exactly, for example:

load(“Essential.RData”)

The Essential.RData file must be in your default working directory and if it is not you must specify the location as part of the filename. Alternatively you can find the working directory in R by using the `getwd()`

command:

getwd()

Then drag the Essential.RData file into that directory and use the `load()`

command:

load("Essential.RData")

### Using the example data

R uses named objects so everything gets a name. You can see what is included in the Essential.RData file by using the `ls()`

command:

ls()

This will show you everything currently in the memory of R. Remember that names are case sensitive so that `Qty`

is not the same as `qty`

. Most of the examples used in the book use data that is simple enough to type directly into R or is available as part of the R datasets package that is available when you install R on your computer. The Essential.RData file contains datasets that I thought were too long and complicated to type directly into R.

## My Publications

I have written several books on ecology and data analysis

## Register your interest for our Training Courses

We run training courses in data management, visualisation and analysis using Excel and R: The Statistical Programming Environment. Courses will be held at one of our training centres in London. Alternatively we can come to you and provide the training at your workplace. Training Courses are also available via an online platform.

## Get In Touch Now

for any information regarding our training courses, publications or help with a data project