Skip to content

Instantly share code, notes, and snippets.

@pcantalupo
Created March 10, 2020 01:45
Show Gist options
  • Save pcantalupo/8fdf1685b60caa88af5fbbb2b7aad9de to your computer and use it in GitHub Desktop.
Save pcantalupo/8fdf1685b60caa88af5fbbb2b7aad9de to your computer and use it in GitHub Desktop.
library(openxlsx)
library(readr)
library(dplyr)
mappings = read.xlsx("mappings.tsv.xlsx") %>% tbl_df()
registration = read.xlsx("Final Registration List.xlsx")
cols = gsub(" ", ".", mappings$FinalRegistrationColumnname)
registration = registration[,!grepl("^What", colnames(registration))] %>%
select(cols) %>% distinct() %>% arrange(Last.Name) %>% tbl_df()
registration
# change column names in Registration to expected col names for Import Spreadsheet
forImport = registration
colnames(forImport) = mappings$ImportSpreadsheet
forImport
forImport %>% count(City, State, `Postal Code`) %>% arrange(-n)
write_csv(forImport, "Import.csv", na="")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment