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
#' 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")) |
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: "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 |
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(getACS) | |
library(tidycensus) | |
commute_time <- tidycensus::get_acs( | |
geography = "county", | |
table = "B08136", | |
year = 2021, | |
survey = "acs5", | |
state = "MD", | |
cache = TRUE | |
) |
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: "gt table list multi-format knit" | |
format: | |
html: default | |
pdf: default | |
--- | |
```{r} | |
library(gt) | |
nested_mtcars <- dplyr::nest_by(mtcars, cyl, .keep = TRUE) |
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
`%||%` <- 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/ |
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-11-16 | |
# 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
library(getACS) | |
library(tidyverse) | |
vehicle_access_acs <- get_acs_tables( | |
"tract", | |
table = "B08201", | |
county = "Baltimore city", | |
state = "MD" | |
) |
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
# 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( |
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
# 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 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
# 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 | |
) | |
) | |
} |