R script to download ACS census tables and load them into a PostgreSQL database
Margaret Atkinson (matkinson@ctps.org) is the author of the original version of this script. This repository has been set up to support revising the script to make the script more generic and reusable. This revision is a work-in-progress, begun by Ben Krepp (bkrepp@ctps.org).
This script requires the following R packages:
- RPostgres
- readxl
- dplyr
- sqldf
- stringr
- hash
Variables whose values are to be "plugged in" by the user have been collected into four "hashes" (key-value pairs) and one string variable:
- Directories: (dirs)
- working_dir
- tracts_bgs_subfolder_name
- FTP download urls: (urls)
- non_tracts_bgs_download_url
- tracts_bgs_download_url
- templates_url
- Zip filenames: (zip_filenames)
- non_tracts_bgs_zip_filename
- tracts_bgs_zip_filename
- templates_zip_filename
- PostgreSQL database connection parameters and user info: (postgres_info)
- database_name
- database_host
- database_port
- database_username
- database_password
- database_all_user - User with "ALL" privileges on database
- database_select_user -- User with only "SELECT" privileges on database
- Data dictionary file name (dataDictfile)