Skip to content

Instantly share code, notes, and snippets.

View charliejhadley's full-sized avatar
🙋‍♀️
All tech is political

Charlie Joey Hadley charliejhadley

🙋‍♀️
All tech is political
View GitHub Profile
@charliejhadley
charliejhadley / stretchy-antarctica.R
Created June 8, 2022 13:09
stretchy-antarctica.R
library(tidyverse)
library(sf)
library(rnaturalearthdata)
countries110 %>%
st_as_sf() %>%
st_transform(crs = 3857) %>%
ggplot() +
geom_sf()
@charliejhadley
charliejhadley / facet-grid_space-free.R
Created May 26, 2022 10:06
facet-grid_space-free.R
library(tidyverse)
library(hrbrthemes)
#> NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes.
#> Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
#> if Arial Narrow is not on your system, please see https://bit.ly/arialnarrow
# rebuilding https://blog.albertkuo.me/post/point-shape-options-in-ggplot/#fnref1
pch_tib <- tibble(
pch_number = 0:25,
pch_description = c(rep("Outline", 15),
@charliejhadley
charliejhadley / where-do-you-wrap.R
Created May 20, 2022 18:31
where-do-you-wrap.R
library(tidyverse)
survey_data <- tribble(
~id, ~group, ~question, ~response,
1, "A", "Do you think survey questions tend to be too long?", "Strong agree",
2, "B", "Do you think survey questions tend to be too long?", "Agree",
3, "C", "Do you think survey questions tend to be too long?", "Strong agree",
4, "A", "Do you like answering surveys, in general?", "Strong disagree",
5, "B", "Do you like answering surveys, in general?", "disagree",
6, "C", "Do you like answering surveys, in general?", "Strong agree",
@charliejhadley
charliejhadley / main-report.Rmd
Created May 19, 2022 15:33
Why can't knit_child() have parameters?!
---
title: "Report on animals"
output: html_document
date: '2022-05-19'
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(
echo = FALSE,
message = FALSE,
data_2020 <- tibble(
id = 1:4,
wk1 = c(1, "-", NA, 4),
wk2 = c(1, "-", 3, 4)
)
data_2021 <- tibble(
id = 1:4,
wk1 = c(1, NA, 3, 4),
wk2 = c(1, 2, 3, 4)
@charliejhadley
charliejhadley / replace-na-shenanigans.R
Created May 11, 2022 16:26
replace-na-shenanigans.R
library(tidyverse)
library(janitor)
library(readxl)
download.file(url = "https://github.com/rfortherestofus/going-deeper/raw/master/data-raw/enrollment-18-19.xlsx",
mode = "wb",
destfile = "data-raw/enrollment-18-19.xlsx")
download.file(url = "https://github.com/rfortherestofus/going-deeper/raw/master/data-raw/enrollment-17-18.xlsx",
@charliejhadley
charliejhadley / live-session-code_survey-monkey.R
Created May 5, 2022 18:00
live-session-code_survey-monkey.R
library(tidyverse)
library(readxl)
library(janitor)
survey_monkey_raw <- read_excel("data/survey-monkey-data.xlsx") %>%
clean_names()
survey_monkey_data <- survey_monkey_raw %>%
slice(-1) %>%
mutate(respondent_id = row_number()) %>%
library(tidyverse)
library(palmerpenguins)
make_penguin_scatter_avoid_tidyeval <- function(facet_variable){
penguins_tidy <- penguins %>%
select(bill_length_mm, bill_depth_mm, all_of(facet_variable)) %>%
rename_with(.cols = 3, ~"thing_to_facet_by")
penguins_tidy %>%
@charliejhadley
charliejhadley / 30DayChartChallenge-2022-04-03.R
Created April 29, 2022 10:19
30DayChartChallenge-2022-04-03 Historical
library(tidyverse)
library(scales)
library(ggalt)
library(hrbrthemes)
library(ggrepel)
library(showtext)
library(ggtext)
# get coords from image ---------------------------------------------------
@charliejhadley
charliejhadley / rose-pagedreport-toc.Rmd
Created April 21, 2022 16:41
rose-pagedreport-toc.Rmd
---
title: "MLCF Success"
subtitle: "Conservation Success"
author: "Dascot Limited"
date: "`r Sys.Date()`"
output:
pagedreport::paged_windmill:
logo: "Dascot_Logo.png"
toc: true
---