Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hunterowens/e11801bd806fe76d7d84aad58f2fa7a3 to your computer and use it in GitHub Desktop.
Save hunterowens/e11801bd806fe76d7d84aad58f2fa7a3 to your computer and use it in GitHub Desktop.
Mapper of disjoint datasets
library(tidyverse)
dot_data <- read_csv('./path/to/dot.csv')
311_data <- read_csv('./path/to/311.csv')
# Shared headers, based on dot list you gave me
headers <- c(Columns by SR # / CD # / Request Type / Address / Description / Submit Date / Closed Date / Current Status / Owner)
dot_data %>%
mutate(key = stringr::str_replace(key, "old_header", "new_header"))
## Repeat
# set the owner to dot
311_data %>%
mutate(key = stringr::str_replace(key, "old_header", "new_header"))
## Repeat
# set the owner to 311
merged_data <- rbind(dot_data, 311_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment