14 R programming

14.1 Modern R with the tidyverse

Bruno Rodrigues

This book can be useful to different audiences. If you have never used R in your life, and want to start, start with Chapter 1 of this book. Chapter 1 to 3 are the very basics, and should be easy to follow up to Chapter 9. Starting with Chapter 9, it gets more technical, and will be harder to follow. But I suggest you keep on going, and do not hesitate to contact me for help if you struggle! Chapter 9 is also where you can start if you are already familiar with R and the {tidyverse}, but not functional programming. If you are familiar with R but not the {tidyverse} (or have no clue what the {tidyverse} is), then you can start with Chapter 4. If you are familiar with R, the {tidyverse} and functional programming, you might still be interested in this book, especially Chapter 9 and 10, which deal with package development and further advanced topics respectively.

https://b-rodrigues.github.io/modern_R/

14.2 stats545 Data wrangling, exploration, and analysis with R

Jenny Bryan

Learn how to:

Explore, groom, visualize, and analyze data, make all of that reproducible, reusable, and shareable, using R. This site is about everything that comes up during data analysis except for statistical modelling and inference.

https://stat545.com/

14.3 What They Forgot to Teach You About R

Jennifer Bryan and Jim Hester

The initial impetus for creating these materials is a two-day hands-on workshop. The target learner:

Has a moderate amount of R and RStudio experience.Is largely self-taught.Suspects they have drifted into some idiosyncratic habits that may slow them down or make their work products more brittle.Is interested in (re)designing their R lifestyle, to be more effective and more self-sufficient.

https://rstats.wtf/

14.4 Field Guide to the R Ecosystem

Mark Sellors

This field guide aims to introduce the reader to the main components of the R ecosystem that may be encountered in “the field”.Whatever the reason, whilst there is a wealth of in-depth information for people actually using the language, I could find precious little information that provided the sort of overview of the ecosystem that I know I’d have appreciated when I first came to the language. And with that thought, a field guide is born…

https://fg2re.sellorm.com/

14.5 YaRrr! The Pirate’s Guide to R

Nathaniel D. Phillips

Learn R from the ground up.

Let me make something very, very clear…

I did not write this book.

This whole story started in the Summer of 2015. I was taking a late night swim on the Bodensee in Konstanz and saw a rusty object sticking out of the water. Upon digging it out, I realized it was an ancient usb-stick with the word YaRrr inscribed on the side. Intrigued, I brought it home and plugged it into my laptop. Inside the stick, I found a single pdf file written entirely in pirate-speak. After watching several pirate movies, I learned enough pirate-speak to begin translating the text to English. Sure enough, the book turned out to be an introduction to R called The Pirate’s Guide to R.

https://bookdown.org/ndphillips/YaRrr/

14.6 Advanced R.

Hadley Whickham

This is the companion website for “Advanced R”, a book in Chapman & Hall’s R Series. The book is designed primarily for R users who want to improve their programming skills and understanding of the language. It should also be useful for programmers coming to R from other languages, as it explains some of R’s quirks and shows how some parts that seem horrible do have a positive side.

The book is free online.

http://adv-r.had.co.nz/

14.7 Efficient R programming

Colin Gillespie and Robin Lovelace

This book is for anyone who wants to make their R code faster to type, faster to run and more scalable. These considerations generally come after learning the very basics of R for data analysis.

The book is free online.

https://csgillespie.github.io/efficientR/

14.8 The Tidyverse Cookbook

Edited by Garrett Grolemund

This book collects code recipes for doing data science with R’s tidyverse. Each recipe solves a single common task, with a minimum of discussion.

https://rstudio-education.github.io/tidyverse-cookbook/

14.9 The tidyverse style guide

Hadley Whickham

Good coding style is like correct punctuation: you can manage without it, butitsuremakesthingseasiertoread. This site describes the style used throughout the tidyverse. It was derived from Google’s original R Style Guide - but Google’s current guide is derived from the tidyverse style guide.

https://style.tidyverse.org/

14.10 Tidyverse design guide

Tidyverse team

The goal of this book is to help you write better R code. It has four main components:

  1. Design problems which lead to suboptimal outcomes.

  2. Useful patterns that help solve common problems.

  3. Key principles that help you balance conflicting patterns.

  4. Selected case studies that help you see how all the pieces fit together with real code.

It is used by the tidyverse team to promote consistency across packages in the core tidyverse.

https://design.tidyverse.org/

14.11 Hands-On Programming with R

Garrett Grolemund

This book will teach you how to program in R, with hands-on examples. I wrote it for non-programmers to provide a friendly introduction to the R language. You’ll learn how to load data, assemble and disassemble data objects, navigate R’s environment system, write your own functions, and use all of R’s programming tools. Throughout the book, you’ll use your newfound skills to solve practical data science problems.

https://rstudio-education.github.io/hopr/

14.12 The R Language

R Core team

A collection of manuals: 1. An Introduction to R 1. The R Language Definition 1. Writing R Extensions 1. R Installation and Administration 1. R Data Import/Export 1. R Internals

https://stat.ethz.ch/R-manual/R-patched/doc/html/

14.13 R language for programmers

John D Cook

I have written software professionally in perhaps a dozen programming languages, and the hardest language for me to learn has been R. The language is actually fairly simple, but it is unconventional. These notes are intended to make the language easier to learn for someone used to more commonly used languages such as C++, Java, Perl, etc.

https://www.johndcook.com/blog/r_language_for_programmers/

14.14 R Cookbook - 2nd edition

JD Long, Paul Teetor

I have written software professionally in perhaps a dozen programming languages, and the hardest language for me to learn has been R. The language is actually fairly simple, but it is unconventional. These notes are intended to make the language easier to learn for someone used to more commonly used languages such as C++, Java, Perl, etc.

Not to be confused with Cookbook for R https://rc2e.com/index.html

14.15 Cookbook for R

Winston Chang

The goal of the cookbook is to provide solutions to common tasks and problems in analyzing data.

Not to be confused with R Cookbook http://www.cookbook-r.com/

14.16 Tidy evaluation

Lionel Henry and Hadley Wickham

This guide is now superseded by more recent efforts at documenting tidy evaluation in a user-friendly way. We now recommend reading:

The new Programming with dplyr vignette.

The Using ggplot2 in packages vignette.

(Oscar’s note: I’m keeping this in for my own reference)

https://tidyeval.tidyverse.org/

14.17 The R Inferno

Patrick Burns

If R’s behaviour has ever suprised you, then this book is a guide for many more surprises, written in the style of Dante. It’s a concise report on number of common-errors and unexpected behaviours in R. This book would make more sense, if you have been programming and are familiar with such behaviours (not all though), as there is little time spent on explaining why part of behaviour. As mentioned, it’s a concise book, 126 books only.

https://www.burns-stat.com/pages/Tutor/R_inferno.pdf

14.18 A sufficient Introduction to R

Derek l. Sonderegger

This book is intended to guide people that are completely new to programming along a path towards a useful skill level using R. I belive that while people can get by with just copying code chunks, that doesn’t give them the background information to modify the code in non-trivial ways. Therefore we will spend more time on foundational details than a “crash-course” would.

https://dereksonderegger.github.io/570L/

14.19 Introduction to Programming with R

Reto Stauffer, Joanna Chimiak-Opoka, Thorsten Simon, Achim Zeileis

a learning resource for programming novices who want to learn programming using the statistical programming language R. While one of the major strengths of R is the broad variety of packages for statistics and data science, this resource focuses on learning and understanding basic programming concepts using base R. Only a couple of additional packages are used and/or briefly discussed for special tasks.

This online book is specifically written for participants of the course “Introduction to Programming: Programming in R” offered by the Digital Science Center at Universität Innsbruck.

https://eeecon.uibk.ac.at/~discdown/rprogramming/index.html

14.20 Mastering Software Development in R

Roger D. Peng, Sean Kross, and Brooke Anderson

This book covers R software development for building data science tools. This book provides rigorous training in the R language and covers modern software development practices for building tools that are highly reusable, modular, and suitable for use in a team-based environment or a community of developers.

Pay what you want for the ebook, minimum $0.00

https://leanpub.com/msdr

14.21 Introduction to R - R spatial

R Spatial

This document provides a concise introduction to R. It emphasizes what you need to know to be able to use the language in any context. There is no fancy statistical analysis here. We just present the basics of the R language itself. We do not assume that you have done any computer programming before (but we do assume that you think it is about time you did). Experienced R users obviously need not read this. But the material may be useful if you want to refresh your memory, if you have not used R much, or if you feel confused.

https://rspatial.org/intr/index.html