Skip to contents

Functions - plotting, colors, fonts, etc

align_cols()
Create column alignment strings for knitr::kable
contrast_colors() mutate_contrast() plot(<cc_df>) plot(<cc_vec>) print(<cc_df>) print(<cc_vec>)
Choose label colors based on contrast
dodge_lbls()
Prepare chart labels that should be repelled apart
endpoint_lbls()
Formatted labels for endpoints of trend charts
font_add_weights()
Register a set of 4 font weights for use with showtext
offset_lbls() ratio_to_max()
Offset bar chart labels without hard-coding
palx() as_tibble(<palx>) plot(<palx>)
Make multi-hue, multi-shade qualitative color palettes
scale_y_barcontinuous() scale_x_barcontinuous()
Set a continuous scale more suited to bar charts
stack_lbls()
Stack labels cumulatively

Functions - text formatting

age_lbls()
Clean up age group labels
clean_titles()
Several options for formatting text into neater titles
round100() comma() percent100() percent_lt1() percent_txt() percent_eng() dollark() dollar1()
Number formatting utilities
number_thresh() percent_thresh() dollar_thresh()
Format and top- or bottom-code numbers based on a threshold
title_case()
Title casing

Functions - exporting

add_logo()
Easily add a logo to a ggplot
write_plot()
Batch save plots to multiple formats.

Functions - misc utilities

glue_here()
Parameterized, project-based file paths
round_sum100()
Round a set of numbers so they'll add up to 100
scaffold_project()
Setup directories for a typical DataHaven project
stdev_brks()
Create labeled intervals based on standard deviations

Datasets

cws_trend
2015-2024 DCWS sample trends
life_exp
Life expectancy
median_age
Median age by sex
self_rated_health
2024 DCWS sample: self-rated health