Skip to content

Instantly share code, notes, and snippets.

View elipousson's full-sized avatar

Eli Pousson elipousson

View GitHub Profile
@elipousson
elipousson / minixcali-d2r.R
Created April 4, 2024 02:55
Example script for converting an excalidraw diagram to a d2 diagram
library(dplyr)
library(rlang)
library(purrr)
# library(d2r)
library(minixcali)
path <- "Untitled-2024-03-28-1327.excalidraw"
file <- xkd_read(path, simplifyVector = TRUE)
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix terms: <http://sample-site/politicalgeography/vocabularies/terms#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix sharepoint-taxonomy: <http://aka.ms/sp-taxonomy-syntax/> .
<http://sample-site/politicalgeography/vocabularies/terms> a owl:Ontology .
terms:politicalgeography a sharepoint-taxonomy:TermSet;
sharepoint-taxonomy:description "A sample term set, describing a simple political geography."@en-us;
sharepoint-taxonomy:termSetName "Political Geography"@en-us;
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 15, 2023 19:04
Notes on sf compatibility with dplyr (and eventually other tidyverse) functions. Updated 2023-12-15.
library(sf)
library(tidyverse)
# 2023-12-15
# Notes to add to https://geocompr.r-universe.dev/articles/geocompkg/tidyverse-pitfalls.html
nc = st_read(system.file("shape/nc.shp", package="sf"))
nc_modified = nc |>
mutate(
@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)