Welcome to the Dickins lab R learning resource. As well as being the title of a novel “the fourth R” alludes to the concept of the three Rs, that is: **R**eading, w**R**iting and a**R**ithmetic, skills considered essential for accessing wider learning. R arguably deserves a place in this list. R is a high-level language with strengths in statistical calculation and graphics. Learning R will give you the ability to program a computer, analyze many types of data and construct visually appealing and informative graphs to represent data and analyses.

This page provides a starting point for R learning. It can be viewed online, but to follow along interactively you also need to download a copy of the GitHub repository on which this page is based.

You may download a copy of this “repository” by clicking on this link. This will download a copy of a folder called “the-fourth-r-main” on your computer. The folder is zipped and your browser is likely to have placed it in your “Downloads” folder. Please ensure you unzip its contents (“Extract All” if using Windows) and move it to a convenient location such as your Desktop.

Please follow the links in this table to view content online:

Level | Skill | Location | Link |
---|---|---|---|

1 | what is R? | what-is-r/ | Quarto Presentation |

2 | simple codes | the-fourth-r-main/docs/ | Quarto Presentation |

3 | object types | the-fourth-r-main/docs/ | Quarto Presentation |

4 | reading data | the-fourth-r-main/docs/ | Quarto Presentation |

5 | basic plots and tidy data | the-fourth-r-main/docs/ | HTML R Markdown |

6 | data wrangling | the-fourth-r-main/pdfs/ | PDF Document |

7 | function | the-fourth-r-main/pdfs/ | PDF Document |

8 | basic plots | the-fourth-r-main/pdfs/ | PDF Document |

9 | summary statistics | the-fourth-r-main/pdfs/ | PDF Document |

10 | basic statistics | the-fourth-r-main/pdfs/ | PDF Document |

11 | Callum’s Penguin Workshop | the-fourth-r-main/pdfs/ | HTML Worksheet |

12 | introduction to tidyverse | the-fourth-r-main/pdfs/ | PDF Document |

13 | advanced base graphics | the-fourth-r-main/pdfs/ | PDF Document |

14 | ggplot2 graphics | the-fourth-r-main/pdfs/ | PDF Document |

15 | time series | the-fourth-r-main/ | Jupyter Notebook |

16 | bonus material | the-fourth-r-main/ | GitHub Markdown |

Notes:

- Time Series Data: these data are from my fitness tracker and are in a JSON-like format. So this example, shows how to wrangle data, read JSON and handle themes and times in ggplot2.
- Heatmap Data: these data are similar to microarray data although they are smaller in extent and not derived from an experiment. Data from this site [accessed 07/05/2015].

If you have your own computer it is easy to install R. You can do so via the Comprehensive R Archive Network (CRAN). To do this you can use your search engine to find “R” and from the R homepage choose a local mirror site (direct link here). This works for all major operating systems. Mac users may, however, also find nightly builds on this bleeding-edge repository. While R is all you need, I strongly recommend using an “Integrated Development Environment” (IDE) while you learn. This is a piece of software that allows you to see extra information (such as what’s in the computer memory, help pages and plots) in an organised layout on your screen. Probably the most popular IDE, and the one I recommend, is the RStudio Open Source Edition.

You may view Jupyter Notebook files using Jupyter Notebook or Jupyter Lab (recommended installation via ana|miniconda) and R Markdown documents can be read by RStudio. I may add some details on this in my tips and tricks repository or in the class, but you can simply follow the online links given above to view these files.

I recommend the following resources for further study of R:

- Tidyverse Homepage: a useful reference point for working with these libraries.
- R for Data Science: a comprehensive book which teaches many aspects of R (from data organisation through plotting to R markdown) with an emphasis on the tidyverse.
- R Graphics Cookbook: the second edition of this reference guide for plotting is most helpful.
- R Graph Gallery: a great place to go for plotting ideas and for coded examples of many common and rare plots.
- Quick R: a useful reference site for basic statistical analyses in R