Skip to content

Instantly share code, notes, and snippets.

View will-r-chase's full-sized avatar

William Chase will-r-chase

View GitHub Profile
library(tidyverse)
library(lubridate)
#reading in data that I copied and pasted
data <- tibble::tribble(
~date, ~no_of_jobs,
"January 2006", 2439100L,
"February 2006", 2444400L,
"March 2006", 2458700L,
"April 2006", 2458500L,
library(tidyverse)
#if not installed, install the colorspace package
#install.packages("colorspace")
library(colorspace)
#Your turn
#This is some data for a line chart
air <-
library(tidyverse)
#if not installed, install the colorspace package
#install.packages("colorspace")
library(colorspace)
#Your turn
#This is some data for a line chart
air <-
library(tidyverse)
#Your turn solutions
#This is some data for a line chart
air <-
airquality %>%
filter(Month == 5) %>%
select(Temp, Ozone, Wind, Day) %>%
pivot_longer(cols = 1:3)
library(tidyverse)
#Your turn
#This is some data for a line chart
air <-
airquality %>%
filter(Month == 5) %>%
select(Temp, Ozone, Wind, Day) %>%
pivot_longer(cols = 1:3)
library(tidyverse)
library(ggtext)
##Your turn
#Use ggtext to make the word 'plastic' bold in the title
#and wrap the subtitle so it is multi-line
plastics <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-01-26/plastics.csv')
library(tidyverse)
library(ggtext)
##Your turn
#Use ggtext to make the word 'plastic' bold in the title
#and wrap the subtitle so it is multi-line
plastics <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-01-26/plastics.csv')
#using custom fonts is enabled by the ragg package
#install.packages("ragg")
library(ggplot2)
library(ragg)
##Your turn
#Take one of the charts we've made and add your own fonts to it
#using custom fonts is enabled by the ragg package
#install.packages("ragg")
library(ggplot2)
library(ragg)
##Your turn
#Take one of the charts we've made and add your own fonts to it
library(tidyverse)
library(patchwork)
#Solutions
#Using charts in plastic_charts.R
#Create a patchwork with one chart in a lefthand column
#spanning two vertical rows, and two charts in a second column
#stacked on top of each other
patchwork <- bar_chart | (bar_chart_2 / pie_chart)