Skip to content

Instantly share code, notes, and snippets.

View elipousson's full-sized avatar

Eli Pousson elipousson

View GitHub Profile
library(marylandedu)
library(baltimoreplanning)
library(bcpss)
library(ggplot2)
program_enrollment <- get_md_enrollment(
c(164, 159),
grade_range = "All Grades",
race = "All")
---
format: typst
---
```{r}
library(tinytable)
x <- mtcars[1:4, 1:5]
```
```{r}
vague_dt_interval <- function(start,
end = NULL,
use_now = TRUE,
unit = "second",
format = c("default", "short", "terse")) {
if (!is.interval(start)) {
if (use_now) {
end <- end %||% lubridate::now()
}
url <- "https://geodata.md.gov/imap/rest/services/Transportation/MD_Transit/FeatureServer/9"

meta <- esri2sf::esrimeta(url)

meta_comparison <- arcgislayers::arc_open(url) |> 
  unclass()

length(meta)
#&gt; [1] 55
@elipousson
elipousson / tidyverse-sf-notes.R
Last active December 28, 2024 20:18
Notes on sf compatibility with dplyr (and eventually other tidyverse) functions. Updated 2024-10-30.
#' Documentation of sf and tidyverse compatibility
#'
#' date-created: 2023-12-15
#' date-modified: 2024-10-30
# Notes to add to https://geocompr.r-universe.dev/articles/geocompkg/tidyverse-pitfalls.html
library(sf)
library(tidyverse)
nc = st_read(system.file("shape/nc.shp", package="sf"))
@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 ----