Skip to content

Instantly share code, notes, and snippets.

View stephhazlitt's full-sized avatar

Stephanie Hazlitt stephhazlitt

View GitHub Profile
@stephhazlitt
stephhazlitt / choropleth-example.txt
Last active July 1, 2023 00:01
Example choropleth using {bcmaps} & data from the B.C. Data Catalogue sourced with {bcdata}
library(bcdata) #get data from the BC Data Catalogue
library(bcmaps) #get maps
library(tidyr) #clean popn data file
library(dplyr) #summarize data
library(stringr) #clean and align RD names
library(ggplot2) #make plot
library(sf) #clip RD with BC boundaries
#get and tidy some population change data from the BC Data Catalogue
rd_popn <- bcdc_get_data(
@stephhazlitt
stephhazlitt / popn-estimates-by-sd-crd-plot
Last active September 26, 2022 04:54
popn-estimates-projections-by-sd-crd-plot
library(here)
library(readr)
library(dplyr)
library(ggplot2)
library(scales)
library(ggrepel)
## Data for School District 61 Population Estimates & Projections from BCStats
## manual online tool: https://bcstats.shinyapps.io/popApp/
@stephhazlitt
stephhazlitt / macbook-pro-m1-2020-setup.md
Last active March 17, 2024 04:11
Macbook Pro (M1 2020) Set-up

MacBook Pro M1 (2020) Set-Up 👩‍💻

This is Steph's "living" document with instructions/documentation of my set-up on a MacBook Pro M1 (2020), with a focus on #rstats data science and meta tools 📊

Point & Click Software 🖱

@stephhazlitt
stephhazlitt / purrr_save_plots.R
Created July 11, 2018 17:48
envreportutils::png_retina & purrr troubles
library(dplyr)
library(ggplot2)
library(purrr)
# make a small df
planets_i_know <- c("Tatooine", "Naboo", "Alderaan", "Endor")
data <- starwars %>%
filter(!is.na(homeworld)) %>%
group_by(homeworld, gender) %>%
@stephhazlitt
stephhazlitt / bcgroundwater_example.R
Last active March 21, 2018 17:24
Example use of `bcgroundwater` R package
install.packages("devtools")
library(devtools)
install_github("bcgov/bcgroundwater")
library(bcgroundwater)
## use ?bcgroundwater to see the Help menu for functions in the package
## get data for OBS WELL 447 - Surrey (Tynehead Park)
@stephhazlitt
stephhazlitt / help_me.R
Created January 28, 2018 01:05
reprex for getting help
library(dplyr) ## starwars data ships with dplyr
library(tibble)
## I am trying to use add_row() to add a total row with a sum of the other rows.
## This does not work
foo <- starwars %>%
select(name, height) %>%
filter(height > 200) %>%
add_row(name = "Total", height = sum(height))