This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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-09-09 | |
# Set up ---- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Read an Excalidraw Markdown file created using the Obsidian Excalidraw | |
#' plugin. | |
#' | |
#' Plugin: https://github.com/zsviczian/obsidian-excalidraw-plugin | |
#' | |
#' This function uses the experimental yyjsonr package | |
#' <https://github.com/coolbutuseless/yyjsonr>. jsonlite would also work here. | |
#' | |
#' @param file A Markdown file created with the Obsidian Excalidraw plugin. | |
#' @param ... Additional parameters passed to [readr::read_lines()] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table <- tidycensus::get_decennial( | |
geography = "block", | |
state = "MD", | |
county = "Baltimore city", | |
year = 2020, | |
table = "H1" | |
) | |
label_census <- function(data, | |
year = 2020, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
# requires bcpss, getdata, mapmaryland, ggplot2 and dplyr | |
params <- | |
list( | |
program_name = c( | |
"John Ruhrah Elementary/Middle", | |
"John Ruhrah Elementary" | |
), | |
program_number = 228 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf")) | |
nc_random_pts <- sf::st_sample(nc, size = 1000) | |
nc_random_pts <- sf::st_join(sf::st_as_sf(nc_random_pts), nc) | |
bind_pt_coords <- function(x, ..., .drop = TRUE) { | |
if (sf::st_geometry_type(x, FALSE) != "POINT") { | |
coords <- suppressWarnings(sf::st_coordinates(sf::st_centroid(x))) | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Is x an GeoPackage filename or path? | |
#' | |
#' @param x File name or path name | |
#' @noRd | |
is_gpkg <- function(x) { | |
grepl("\\.gpkg$", x) | |
} | |
#' Check if x is a GeoPackage file | |
#' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(getdata) | |
library(ggplot2) | |
library(mapmaryland) | |
library(maplayer) | |
library(dplyr) | |
dead_zones <- | |
get_esri_data( | |
url = "https://geodata.md.gov/imap/rest/services/Environment/MD_ChesapeakeBayDeadZones/FeatureServer/0", | |
crs = 3857 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/version 3 | |
/name [ 15 | |
6767706c6f74322068656c70657273 | |
] | |
/isOpen 1 | |
/actionCount 2 | |
/action-1 { | |
/name [ 13 | |
52656c65617365204d61736b73 | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# read_sf_felt( | |
# "https://felt.com/embed/map/Example-Greatest-Bowling-Alleys-in-the-US-W9A04huJxTSCxfESYhkY9AOA" | |
# ) | |
read_sf_felt <- function(url) { | |
req <- | |
httr2::request( | |
url | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pak::pkg_install("elipousson/mapbaltimore") | |
# pak::pkg_install("elipousson/sfext") | |
# pak::pkg_install("elipousson/getdata") | |
library(dplyr) | |
library(purrr) | |
library(sfext) | |
library(mapbaltimore) | |
# path = # path to folder with photos |