Saves an ACS data set to a specified folder (dataSavePath) and creates/adds to a .csv documentation file (in docPath). Note that you can either pass a data frame object in your environment (via cleanDataFrame) or you can download a "raw" data set from ACS using tidycensus (see associated get_acs() arguments).

save_acs(
  theme,
  title,
  collector,
  year = 2019,
  status = "Raw",
  storage = "GitHub",
  project = "All 3",
  ethics = "Yes",
  bias = "None",
  cleanDataFrame = NULL,
  geography = "county",
  variables = NULL,
  table = NULL,
  state = "IA",
  county = NULL,
  moe_level = 90,
  survey = "acs5",
  geometry = FALSE,
  dataSavePath = "./",
  docPath = dataSavePath,
  returnData = FALSE
)

Arguments

theme

theme of data (demographics, etc.)

title

title of data set

collector

name of person who performed data collection

year

year associated with the ACS data (e.g., 2019)

status

whether the data is "Raw" or "Clean" -- note that other options are not supported

storage

where the data are stored (defaults to GitHub)

project

the project(s) the data pertain to

ethics

whether there are ethical concerns for this data set

bias

whether there are bias cocnerns for this data set

cleanDataFrame

(optional) a data frame object containing processed ACS data

geography

(optional) geography of your data. See tidycensus::get_acs

variables

(optional) Vector of character strings containing variable IDs. See tidycensus::get_acs

table

(optional) ACS table for which you would like to request all variables. See tidycensus::get_acs

state

(optional) a vector of states for which you are requesting data. See tidycensus::get_acs

county

(optional) the county for which you are requesting data. See tidycensus::get_acs

moe_level

(optional) the confidence level of the returned margin of error. See tidycensus::get_acs

survey

(optional) acs contains one-year ("acs1"), three-year ("acs3"), or five-year surveys ("acs5"). See tidycensus::get_acs

geometry

(optional) if FALSE, returns a regular tibble of ACS data (setting to TRUE is not recommended). See tidycensus::get_acs

dataSavePath

path a folder in which you want to save the ACS data. Defaults to current working directory

docPath

path to a folder containing a documentation .csv file. Defaults to current working directory

returnData

if TRUE, returns the data frame after saving it in dataSavePath

Author

Joe Zemmels

Examples

if (FALSE) { #if you want to download and save a new, "raw" ACS data set using tidycensus: save_acs(theme = "demographics",title = "sex by age",collector = "Joe",status = "Raw", table = "B01001", docPath = "./",dataSavePath = "localPath/data_raw/", #need to specify path to data_raw/ returnData = TRUE) # if you have a cleaned data frame in your current environment that you want to save: # ... code to create a cleaned data set called sexByAge goes here ... save_acs(theme = "demographics",title = "sex by age",collector = "Joe",status = "Clean", cleanDataFrame = sexByAge, docPath = "./",dataSavePath = "localPath/data_clean/") #need to specify path to data_clean/ }