getacs

A R package to work with ACS data from {tidycensus}

https://github.com/elipousson/getacs

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.8%) to scientific vocabulary

Keywords

american-community-survey r-package tidycensus
Last synced: 10 months ago · JSON representation

Repository

A R package to work with ACS data from {tidycensus}

Basic Info
Statistics
  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • Open Issues: 2
  • Releases: 0
Topics
american-community-survey r-package tidycensus
Created almost 3 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog License Codemeta

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# getACS



[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Project Status: WIP -- Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![Codecov test coverage](https://codecov.io/gh/elipousson/getACS/graph/badge.svg)](https://app.codecov.io/gh/elipousson/getACS)


The goal of getACS is to make it easier to work with [American Community Survey data](https://www.census.gov/programs-surveys/acs) from the [tidycensus package](https://walker-data.com/tidycensus/) by Kyle Walker and others.

This package includes:

-   Functions that extend `tidycensus::get_acs()` to support multiple tables, geographies, or years
-   Functions for creating formatted tables from ACS data using the [gt package](https://gt.rstudio.com/)

As of April 2024, this package uses a development version of `{tigris}`, available at .

## Installation

You can install the development version of getACS from [GitHub](https://github.com/) with:

``` r
# install.packages("pak")
pak::pkg_install("elipousson/getACS")
```

## Usage

```{r setup}
library(getACS)
library(gt)
library(ggplot2)
```

The main feature of `{getACS}` is support for returning multiple tables, geographies, and years.

```{r}
acs_data <- get_acs_geographies(
  geography = c("county", "state"),
  county = "Baltimore city",
  state = "MD",
  table = "B08134",
  year = 2022,
  quiet = TRUE
)
```

The package also includes utility functions for filtering data and selecting columns to support the creation of tables using the `{gt}` package:

```{r}
tbl_data <- filter_acs(acs_data, indent == 1, line_number <= 10)
tbl_data <- select_acs(tbl_data)

commute_tbl <- gt_acs(
  tbl_data,
  groupname_col = "NAME",
  column_title_label = "Commute time",
  table = "B08134"
)

as_raw_html(commute_tbl)
```

The `gt_acs_compare()` function also allows side-by-side comparison of geographies:

```{r}
commute_tbl_compare <- gt_acs_compare(
  data = tbl_data,
  id_cols = "column_title",
  column_title_label = "Commute time",
  table = "B08134"
)

as_raw_html(commute_tbl_compare)
```

`gt_acs_compare_vars()` is a variant on `gt_acs_compare()` where the default values support comparisons with values in columns and geographical areas in rows:

```{r}
commute_tbl_compare_vars <- acs_data |>
  filter_acs(indent == 1, line_number > 10) |>
  gt_acs_compare_vars(
    table = acs_data$table_id
  )

as_raw_html(commute_tbl_compare_vars)
```

The package also includes several functions to support creating plots with the `{ggplot2}` package including `geom_acs_col()` and `labs_acs_survey()`:

```{r}
plot_data <- acs_data |>
  filter_acs(indent == 1, line_number > 10) |>
  select_acs() |>
  fmt_acs_county(state = "Maryland")

plot_data |>
  ggplot() +
  geom_acs_col(
    fill = "NAME",
    position = "dodge",
    color = NA,
    alpha = 0.75,
    perc = TRUE,
    errorbar_params = list(position = "dodge", linewidth = 0.25)
  ) +
  scale_y_discrete("Means of transportation to work") +
  scale_fill_viridis_d("Geography") +
  labs_acs_survey(
    .data = acs_data
  ) +
  theme_minimal()
```

The `geom_acs_col()` function calls `geom_acs_errorbar()` (passing the `errorbar_params` argument as additional parameters) and `scale_x_acs()` or `scale_y_acs()` (depending on whether `orientation = "y"` or the default value of `NA`).

For more information on working with Census data in R [read the book *Analyzing US Census Data: Methods, Maps, and Models in R*](https://walker-data.com/census-r) (February 2023).

## Related projects

### Related R packages and analysis projects

-   [{easycensus}](https://github.com/CoryMcCartan/easycensus): Quickly Extract and Marginalize U.S. Census Tables
-   [{cwi}](https://ct-data-haven.github.io/cwi/): Functions to speed up and standardize Census ACS data analysis for multiple staff people at DataHaven, preview trends and patterns, and get data in more layperson-friendly
-   [{camiller}](https://camille-s.github.io/camiller/): A set of convenience functions, functions for working with ACS data via `{tidycensus}`
-   [{psrccensus}](https://psrc.github.io/psrccensus/): A set of tools developed for PSRC (Puget Sound Regional Council) staff to pull, process, and visualize Census Data for geographies in the Central Puget Sound Region.
-   [{CTPPr}](https://github.com/Westat-Transportation/CTPPr): A R package for loading and working with the US Census CTPP survey data.
-   [{lehdr}](https://github.com/jamgreen/lehdr): a package to grab LEHD data in support of city and regional planning economic and transportation analysis
-   [{mapreliability}](https://github.com/austensen/mapreliability): A R package for map classification reliability calculator
-   [Studying Neighborhoods With Uncertain Census Data](https://github.com/geoss/acs_demographic_clusters): Code to create and visualize demographic clusters for the US with data from the American Community Survey

### Related Python libraries

- [census-data-aggregator](https://github.com/datadesk/census-data-aggregator): A Python library from the L.A. Times data desk to help "combine U.S. census data responsibly"
- [census-table-metadata](https://github.com/censusreporter/census-table-metadata): Tools for generating metadata about tables and fields in a Census release based on sequence lookup and table shell files. (Note: the pre-computed data from this repository is used to label ACS data by `label_acs_metadata()`)

Owner

  • Name: Eli Pousson
  • Login: elipousson
  • Kind: user
  • Location: Baltimore, MD
  • Company: Baltimore City Department of Planning

I love old buildings and bicycles. Planner with the Baltimore City Department of Planning. Former preservationist @baltimoreheritage

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "getACS",
  "description": "A package with helper functions for working with Census data downloaded with the tidycensus package.",
  "name": "getACS: Help Wrangling American Community Survey Data from tidycensus",
  "codeRepository": "https://github.com/elipousson/getACS",
  "issueTracker": "https://github.com/elipousson/getACS/issues",
  "license": "https://spdx.org/licenses/MIT",
  "version": "0.1.1.9003",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.3.2 (2023-10-31)",
  "author": [
    {
      "@type": "Person",
      "givenName": "Eli",
      "familyName": "Pousson",
      "email": "eli.pousson@gmail.com",
      "@id": "https://orcid.org/0000-0001-8280-1706"
    }
  ],
  "copyrightHolder": [
    {
      "@type": "Person",
      "givenName": "Eli",
      "familyName": "Pousson",
      "email": "eli.pousson@gmail.com",
      "@id": "https://orcid.org/0000-0001-8280-1706"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Eli",
      "familyName": "Pousson",
      "email": "eli.pousson@gmail.com",
      "@id": "https://orcid.org/0000-0001-8280-1706"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "forcats",
      "name": "forcats",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=forcats"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "readr",
      "name": "readr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=readr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "rmarkdown",
      "name": "rmarkdown",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rmarkdown"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "testthat",
      "name": "testthat",
      "version": ">= 3.0.0",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=testthat"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "R",
      "name": "R",
      "version": ">= 2.10"
    },
    "2": {
      "@type": "SoftwareApplication",
      "identifier": "cli",
      "name": "cli",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=cli"
    },
    "3": {
      "@type": "SoftwareApplication",
      "identifier": "dplyr",
      "name": "dplyr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=dplyr"
    },
    "4": {
      "@type": "SoftwareApplication",
      "identifier": "ggplot2",
      "name": "ggplot2",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=ggplot2"
    },
    "5": {
      "@type": "SoftwareApplication",
      "identifier": "glue",
      "name": "glue",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=glue"
    },
    "6": {
      "@type": "SoftwareApplication",
      "identifier": "gt",
      "name": "gt",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=gt"
    },
    "7": {
      "@type": "SoftwareApplication",
      "identifier": "knitr",
      "name": "knitr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=knitr"
    },
    "8": {
      "@type": "SoftwareApplication",
      "identifier": "lifecycle",
      "name": "lifecycle",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=lifecycle"
    },
    "9": {
      "@type": "SoftwareApplication",
      "identifier": "purrr",
      "name": "purrr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=purrr"
    },
    "10": {
      "@type": "SoftwareApplication",
      "identifier": "rappdirs",
      "name": "rappdirs",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rappdirs"
    },
    "11": {
      "@type": "SoftwareApplication",
      "identifier": "rlang",
      "name": "rlang",
      "version": ">= 1.1.0",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rlang"
    },
    "12": {
      "@type": "SoftwareApplication",
      "identifier": "scales",
      "name": "scales",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=scales"
    },
    "13": {
      "@type": "SoftwareApplication",
      "identifier": "sf",
      "name": "sf",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=sf"
    },
    "14": {
      "@type": "SoftwareApplication",
      "identifier": "stats",
      "name": "stats"
    },
    "15": {
      "@type": "SoftwareApplication",
      "identifier": "stringr",
      "name": "stringr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=stringr"
    },
    "16": {
      "@type": "SoftwareApplication",
      "identifier": "tidycensus",
      "name": "tidycensus",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=tidycensus"
    },
    "17": {
      "@type": "SoftwareApplication",
      "identifier": "tidyr",
      "name": "tidyr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=tidyr"
    },
    "18": {
      "@type": "SoftwareApplication",
      "identifier": "tidyselect",
      "name": "tidyselect",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=tidyselect"
    },
    "19": {
      "@type": "SoftwareApplication",
      "identifier": "tigris",
      "name": "tigris",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=tigris"
    },
    "20": {
      "@type": "SoftwareApplication",
      "identifier": "vctrs",
      "name": "vctrs",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=vctrs"
    },
    "21": {
      "@type": "SoftwareApplication",
      "identifier": "withr",
      "name": "withr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=withr"
    },
    "SystemRequirements": null
  },
  "fileSize": "507.337KB",
  "relatedLink": "https://elipousson.github.io/getACS/",
  "releaseNotes": "https://github.com/elipousson/getACS/blob/master/NEWS.md",
  "readme": "https://github.com/elipousson/getACS/blob/main/README.md",
  "developmentStatus": [
    "https://lifecycle.r-lib.org/articles/stages.html#experimental",
    "https://www.repostatus.org/#wip"
  ],
  "keywords": [
    "american-community-survey",
    "tidycensus",
    "r-package"
  ]
}

GitHub Events

Total
  • Watch event: 1
  • Push event: 6
Last Year
  • Watch event: 1
  • Push event: 6

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 2
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • elipousson (2)
Pull Request Authors
Top Labels
Issue Labels
bug (1)
Pull Request Labels

Dependencies

.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R >= 2.10 depends
  • cli * imports
  • dplyr * imports
  • glue * imports
  • knitr * imports
  • lifecycle * imports
  • purrr * imports
  • rlang >= 1.1.0 imports
  • sf * imports
  • stringr * imports
  • tidycensus * imports
  • tidyselect * imports
  • tigris * imports
  • vctrs * imports
  • forcats * suggests
  • ggplot2 * suggests
  • gt * suggests
  • readr * suggests