acs_transform: Parse raw data, calculate new varibles, export as csv

Description Usage Arguments

View source: R/acs_transform.R

Description

This function parses the data downloded by acs_download() and creates a csv file for the selected parameters.

Usage

1
acs_transform(year, span, geo, sum_levels, keep_vars, acs_dir = ".", .f = NULL)

Arguments

year

[integer(1)]: The year of the desired ACS sample. For example, use 2010 for the 2010 1-year ACS or the 2006-2010 5-yer ACS.

span

[integer(1)]: The span of years for ACS estimates. ACS contains 1-, 3-, and 5-year surveys.

geo

[charater(1)]: The 2-letter state abbreviation or 2-digit FIPS code for the state for which data will be downloaded. For geogrpahies that do not nest within states, use "us".

sum_levels

[character]: The Census Bureau codes for the summary level to include in the table. (eg. "010" = United States) For full list see https://factfinder.census.gov/help/en/summary_level_code_list.htm.

keep_vars

[character]: A character vector of ACS variable codes to be included in the output table, using the format "b25003_001".

acs_dir

[character(1)]: The root directory in which all the ACS data has been downloaded with acs_download(). Defaults to current working directory.

.f

A function or formula to be passed to purrr::as_mapper(). The function must take a single dataframe as the only argument, and return a single dataframe.

If a function, it is used as is.

If a formula, e.g. ~ .x + 2, it is converted to a function. There are three ways to refer to the arguments:

  • For a single argument function, use . * For a two argument function, use .x and .y * For more arguments, use ..1, ..2, ..3 etc

This syntax allows you to create very compact anonymous functions.


austensen/acssf documentation built on Nov. 18, 2020, 4:44 a.m.