Slides and other materials for all 10 working sessions.
Create version-controlled directory for your future website!
But also:
We will rely heavily on Happy Git and GitHub with R, in particular chapters 4, 6, 7, 11, and 12
Create a personal website to showcase your work
_site.yml
to control website structureThe 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
Ultimately we will deploy our websites via GitHub Pages
But first:
.bib
file for referencesThe distill website has articles on distill basics as well as citations
GitHub docs has an overview of publishing via GitHub Pages here
Week 03 slides
Save .bib example file
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.
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
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
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.
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
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
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.
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
Week 06 slides
Save week06_functions.Rmd
to run code during the session
Practice working with version-controlled projects with Git, specifically focusing on tools for collaboration.
We will
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
Install GitKraken on your computer. Also make sure you have a current version of packages usethis and gh installed.
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
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
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
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
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.
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
We will be practice making reproducible examples with package reprex. Makes sure you have the current versions of reprex and datapasta installed.
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.
See Yihui Xie’s GitHub issue guide. This guide is specific to repositories he maintains but contains good general advice.
We will practice making reproducible examples with package reprex. Makes sure you have the current version of reprex installed.
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 ...".