Skip to content

Instantly share code, notes, and snippets.

View elipousson's full-sized avatar

Eli Pousson elipousson

View GitHub Profile
@elipousson
elipousson / final-project-presentation-template.qmd
Created December 13, 2023 17:42
GES 668: Building Spatial Datasets Final Project Presentation template (last updated 2023-12-13)
---
title: "GES668: Your Project Title"
author: "Your Name"
format: revealjs
---
## Using this template
:::{.callout-tip collapse=false appearance='default' icon=true}
## How to use this template
@elipousson
elipousson / 2023-12-08_t101-baltimore-msa-transportation.R
Created December 8, 2023 19:00
Script from July 2023, updated 2023-12-08.
library(getACS)
library(tidycensus)
commute_time <- tidycensus::get_acs(
geography = "county",
table = "B08136",
year = 2021,
survey = "acs5",
state = "MD",
cache = TRUE
)
---
title: "gt table list multi-format knit"
format:
html: default
pdf: default
---
```{r}
library(gt)
nested_mtcars <- dplyr::nest_by(mtcars, cyl, .keep = TRUE)
`%||%` <- function(x, y) {
if (rlang::is_null(x)) {
y
} else {
x
}
}
# Quarto extension functions are based on the quartools package:
# https://github.com/ElianHugh/quartools/
# title: R script for validating Baltimore city bike facility data, updating the
# schema to match new BMC standard, and adding new attributes for responsible
# agency and other characteristics
#
# author: Eli Pousson
# date: 2023-09-07
# last-modified: 2023-11-16
# Set up ----
library(getACS)
library(tidyverse)
vehicle_access_acs <- get_acs_tables(
"tract",
table = "B08201",
county = "Baltimore city",
state = "MD"
)
@elipousson
elipousson / 2023-10-25_make-location-zoning-map_planning-districts.R
Created October 25, 2023 15:31
Script for prepping location zoning maps
# Get zoning metadata from {mapmaryland}
baltimore_zoning_info <- dplyr::filter(
mapmaryland::md_zoning_info,
county == stringr::str_remove(map_params$county_name, ", Maryland$")
)
# Create format function with custom colors ----
zoning_colors <- tibble::tribble(
# Install packages if needed
# install.packages(c("skimr", "spData", "tidyverse", "sf", "gt"))
# Load packages
library(spData)
library(tidyverse)
library(sf)
library(gt)
# Set a default ggplot2 theme
# This is a cleaned up version of your original function
area_square_km <- function(data, ...) {
data |>
dplyr::mutate(
dplyr::across(
dplyr::all_of(...),
~ .x / 1000000
)
)
}
library(tidyverse)
library(sf)
c("A", "B", "C")
"ABC"
str_flatten(c("A", "B", "C"))
us_states |>