1 of 13

R4DS Advanced R Book club

August 2020 Cohort

Kevin Kent

2020-07-28

2 of 13

Welcome!

We will be meeting to discuss a different chapter of Advanced R by Hadley Wickham every Thursday at 7:30 PM EST.

Sessions will be recorded if you can’t make it to the session.

Slides and schedule will be posted on the Advanced R repo.

You can share questions, observations, etc in the #book_club-advanced_r channel on the slack throughout the book club and beyond

The first cohort created an AMAZING bookdown for questions and answers for each chapter as well as an xaringan template for markdown slides

3 of 13

Today’s Agenda

  • Introduce ourselves, goals for this bookclub
  • Brief introduction to the book
  • What you’ll need for the book club
  • Discuss desired frequency and format for sessions
  • See who wants to sign up to present for next two weeks!
  • Chapter 2 preview and focus questions

4 of 13

Introduce Ourselves

Who you are and what you goal is for participating in this book club

5 of 13

Goal of the book (from Hadley)

This book is my attempt to pass on what I’ve learned so that you can understand the intricacies of R as quickly and painlessly as possible. Reading it will help you avoid the mistakes I’ve made and dead ends I’ve gone down, and will teach you useful tools, techniques, and idioms that can help you to attack many types of problems. In the process, I hope to show that, despite its sometimes frustrating quirks, R is, at its heart, an elegant and beautiful language, well tailored for data science.” - Introduction, Advanced R

6 of 13

What you will learn

  • Be familiar with the foundations of R. You will understand complex data types and the best ways to perform operations on them. You will have a deep understanding of how functions work, you’ll know what environments are, and how to make use of the condition system.
  • Understand what functional programming means, and why it is a useful tool for data science.
  • Know about R’s rich variety of object-oriented systems.
  • Appreciate the double-edged sword of metaprogramming. You’ll be able to create functions that use tidy evaluation, saving typing and creating elegant code to express important operations. You’ll also understand the dangers and when to avoid it.
  • Have a good intuition for which operations in R are slow or use a lot of memory.

*From Introduction, Advanced R

7 of 13

Book structure

Sections

  1. Foundations
  2. Functional programming
  3. Object-oriented programming
  4. Metaprogramming
  5. Techniques

8 of 13

Chapter Structure

  1. Introduction
    1. Chapter topics and goals
  2. Pre-quiz
  3. Chapter outline
  4. Prerequisites (sometimes)
  5. Content
  6. Quiz Answers

9 of 13

Helpful learning techniques

  • From Hadley
    • Reading source code
    • Scientific mindset
  • Try the quiz and to answer the focus questions before you start a chapter
  • Write down or ask questions, connections to prior experience or knowledge (ex. problems you’ve faced in the past, other similar techniques, an analogy) as you are reading
  • Answer the quiz after you complete the chapter
  • Summarize the chapter
    • Verbally or in a diagram
    • Try without looking back first!
  • Periodically revisit the quiz questions from previous chapters, try to see if you have a different way of approaching the problems now

10 of 13

What You Need for this Book Club

  1. Install R
  2. Install R studio
  3. We will use various packages along the way (ex. lobstr), but it’s mostly in base R
    1. If you need to install a package, use install.packages(‘packagename’) in the R console

11 of 13

Session Frequency and Format

How often do we want to meet?

Do we want a consistent structure for the sessions or leave it up to the facilitator? A blend?

Should we choose a dataset to use for all the different examples in the book?

  • Previous cohort chose a beer dataset

12 of 13

Chapter 2 Preview and Focus Questions

Names and values

  • What is the difference between an object’s name and its values?
  • When you modify a vector, when does a copy occur? Are there cases when a copy isn’t created?
  • How do you check how much space and object occupies? What kinds of objects occupy the most/least space?
  • When does R’s garbage collection usually run? How do you manually clean up memory?

13 of 13

Resources