Class Materials

Slides and other materials for all 10 working sessions.

Week 1: Introducing Git and GitHub

Goals

Create version-controlled directory for your future website!

But also:

Resources

We will rely heavily on Happy Git and GitHub with R, in particular chapters 4, 6, 7, 11, and 12

Materials for class

Week 01 slides

Week 2: Create a distill website

Goals

Create a personal website to showcase your work

Resources

The distill website has great material for getting started: https://rstudio.github.io/distill/
Tom Mock has a nice intro to distill here
Alison Hill’s post on postcards here
The distillery showcase is great for inspiration and ideas on website design

Materials for class

Week 02 slides

Week 3: More on distill articles and deploy website

Goals

Ultimately we will deploy our websites via GitHub Pages

But first:

Resources

The distill website has articles on distill basics as well as citations
GitHub docs has an overview of publishing via GitHub Pages here

Materials for class

Week 03 slides
Save .bib example file

Week 4: Intro to display tables with gt

Goals

Make display tables for output documents (e.g., manuscripts, presentations) using the gt package. We’re starting with the basics: controlling the table content, adding information to the table, changing the table look, and saving to different formats.

Resources

Thomas Mock has made a gt Cookbook that goes through functions in great detail
The gt package website has a nice intro.
Thomas Mock wrote a post based on the “Ten Guidelines to Better Tables” paper that recreates tables with gt

Materials for class

Make sure you have installed current versions of packages gt and dplyr

Week 04 slides
Save week04_gt_basics.Rmd to run code during the session

Week 5: gt flair: colors, images, and themes

Goals

We’ll look at a few more advanced features of gt, including adding cell text and fill colors, adding images to tables, and highlighting values. We’ll also take a look at how folks build themes for their tables.

Resources

The gt Cookbook has a section on colors
Liam Bailey walks through a more complex gt table-making example with colors and images
Thomas Mock’s Advanced Cookbook has examples of creating themes and adding elements like bar charts
See Anthony Schmidt’s post on a gt APA theme here

Materials for class

Make sure you have installed current versions of packages gt, dplyr, and tidyr

Week 05 slides
Save week05_more_gt.Rmd to run code during the session

Week 6: Writing functions in R

Goals

Gain understanding of and learn how to write basic functions in R

We’ll discuss the basic structure of functions and then practice giving inputs and making outputs. We spend some time looking through the code of existing R functions.

Resources

For more on all aspects of functions, see the Functions chapter in Wickham and Grolemund’s R for Data Science
Rice and Lumley’s presentation on writing functions is a nice overview
If you are ready to go further with functions see Stephanie Kirmer’s presentation

Materials for class

Week 06 slides
Save week06_functions.Rmd to run code during the session

Week 7: More Git and GitHub

Goals

Practice working with version-controlled projects with Git, specifically focusing on tools for collaboration.

We will

Resources

GitHub articles on adding collaborators and README files
Brief article from GitKraken on their merge conflict tool
Package usethis article on pull request helpers
A lecture in the R programming for biologists class outlines the basic approach to pull requests without usethis

Materials for class

Install GitKraken on your computer. Also make sure you have a current version of packages usethis and gh installed.

Week 07 slides

Week 8: Using interactive elements in HTML documents

Goals

This week we will explore a handful of packages based on htmlwidgets for adding interactive elements to static HTML documents. We will finish with an example of adding interactive elements to a basic dashboard with flexdashboard.

We will

Resources

Intro to htmlwidgets
Using plotly from R
Interactive R data objects with DT
Interactive maps with leaflet
Charting time series data in R with dygraphs
Interactive dashboards in R with flexdashboard

Materials for class

We are exploring a variety of packages this week. Make sure you have current versions of: htmlwidgets, palmerpenguins, ggplot2, plotly, DT, leaflet, dygraphs, flexdashboard

Week 08 slides
Save week08_interaction.Rmd to knit to HTML output during the session

Week 9: Reproducible examples with reprex

A couple of packages that folks might be interested as a follow-up to topics discussed in week 8:
gganimate for animating plots
geofacet for faceting plots by geographic units

Goals

The ultimate goal this week is to understand how to make a reproducible example or reprex when asking a question or reporting an issue. We’ll discuss the elements of a reprex while working through a practice example and then use package reprex to create pasteable code and output.

Resources

Intro article and Reprex do’s and don’ts from the reprex website
Sharla Gelfand’s “make a reprex… please” slides and recording
RStudio Community guide
Stack Overflow canonical thread
Tidyverse help guide
How to Datapasta

Materials for class

We will be practice making reproducible examples with package reprex. Makes sure you have the current versions of reprex and datapasta installed.

Week 09 slides

Week 10: GitHub issues

Goals

We will discuss the etiquette of reporting an issue for R packages on GitHub, then practice making an issue using reprex for the code and output.

Resources

See Yihui Xie’s GitHub issue guide. This guide is specific to repositories he maintains but contains good general advice.

Materials for class

We will practice making reproducible examples with package reprex. Makes sure you have the current version of reprex installed.

Week 10 slides

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".