Skip to content

Latest commit

 

History

History
106 lines (78 loc) · 2.51 KB

README.md

File metadata and controls

106 lines (78 loc) · 2.51 KB

tcdsb

R-CMD-check

The goal of tcdsb is to provide report templates and ggplot themes that align with the visual identity of the Toronto Catholic District School Board.

Installation

You can install the development version of tcdsb from GitHub with:

# install.packages("devtools")
devtools::install_github("grousell/tcdsb")

Plot Example

Here is a basic plot:

library(tidyverse)
#> Warning: package 'tidyverse' was built under R version 4.3.3
#> Warning: package 'ggplot2' was built under R version 4.3.3
#> Warning: package 'tidyr' was built under R version 4.3.3
#> Warning: package 'dplyr' was built under R version 4.3.3
#> Warning: package 'stringr' was built under R version 4.3.3
#> Warning: package 'lubridate' was built under R version 4.3.3
library(tcdsb)

mtcars |> 
  head(3) |> 
  rownames_to_column("car") |> 
  ggplot(aes(x = car, y = disp)) +
  geom_col() + 
  labs(title = "Title of Plot", 
       subtitle = "Subtitle", 
       x = NULL, 
       y = "Displacement") 

The tcdsb_colours_fonts function loads the appropriate fonts and HEX colours.

tcdsb_colours_fonts()

By adding tcdsb_ggplot_theme at the end of the code to build the plot, a consistent theme is applied.

mtcars |> 
  head(3) |> 
  rownames_to_column("car") |> 
  ggplot(aes(x = car, y = disp)) +
  geom_col() + 
  labs(title = "Title of Plot", 
       subtitle = "Subtitle", 
       x = NULL, 
       y = "Displacement") + 
  tcdsb::tcdsb_ggplot_theme()

Custom colours can be added to the chart using tcdsb_board_color.

mtcars |> 
  head(3) |> 
  rownames_to_column("car") |> 
  ggplot(aes(x = car, y = disp)) +
  geom_col(fill = tcdsb_board_color) + 
  labs(title = "Title of Plot", 
       subtitle = "Subtitle", 
       x = NULL, 
       y = "Displacement") + 
  tcdsb::tcdsb_ggplot_theme()

Project Setup Example

# tcdsb::tcdsb_project_setup()

Creates a README file and folders for reference documents, R scripts, assets (i.e. image files), raw and clean data.