geogenr

Generator from American Community Survey (ACS) Geodatabases

https://github.com/josesamos/geogenr

Science Score: 13.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
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (20.3%) to scientific vocabulary
Last synced: 7 months ago · JSON representation

Repository

Generator from American Community Survey (ACS) Geodatabases

Basic Info
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 4
Created over 5 years ago · Last pushed almost 2 years ago
Metadata Files
Readme License

README.Rmd

---
output: github_document
---



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

# geogenr geogenr website



[![CRAN status](https://www.r-pkg.org/badges/version/geogenr)](https://CRAN.R-project.org/package=geogenr)
[![R-CMD-check](https://github.com/josesamos/geogenr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/josesamos/geogenr/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/josesamos/geogenr/branch/master/graph/badge.svg)](https://app.codecov.io/gh/josesamos/geogenr?branch=master)
[![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/geogenr?color=brightgreen)](https://www.r-pkg.org:443/pkg/geogenr)



The [American Community Survey (ACS)](https://www.census.gov/programs-surveys/acs) offers geodatabases with geographic information and associated data of interest to researchers in the area. The goal of `geogenr` is to facilitate access to this information through functions that allow us to select the geodatabases that interest us, download them, access the information they contain, filter it and export it in various formats so that we can process it with other tools if required.

## Installation

You can install the released version of `geogenr` from [CRAN](https://CRAN.R-project.org) with:

``` r
install.packages("geogenr")
```

And the development version from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("josesamos/geogenr")
```
## Example

Each ACS geodatabase is structured in layers: a geographic layer, a metadata layer, and the rest are data layers. Accessing data with this structure is not trivial. The goal of the `geogenr` package is to make it easier.

First, we select and download the ACS geodatabases that we need. We can use the functions offered by the package or download and decompress them by other means. We create an object of class `acs_5yr` indicating the work folder.

```{r}
library(geogenr)

dir <- system.file("extdata/acs_5yr", package = "geogenr")

ac <- acs_5yr(dir)
```

We can query the available geodatabases by area, subject and year using the methods offered by the object. We also download the geodatabases of the areas and years that we need.

```{r}
ac |>
  get_area_groups()

ac |>
  get_areas(group = "Legal and Administrative Areas")

ac |>
  get_area_years(area = "Alaska Native Regional Corporation")

ac <- ac |>
  select_area_files("Alaska Native Regional Corporation", 2020:2021)

files <- ac |>
  download_selected_files(unzip = FALSE)
```

```{r, echo=FALSE}
dir <- tempdir()
source_dir <- system.file("extdata/acs_5yr", package = "geogenr")
files <- list.files(source_dir, "*.zip", full.names = TRUE)
file.copy(from = files, to = dir, overwrite = TRUE)
ac <- acs_5yr(dir)
```

We unzip the files and check that the data is available.

```{r}
files <- ac |>
  unzip_files()

ac |>
  get_available_areas()

ac |>
  get_available_area_years(area = "Alaska Native Regional Corporation")
```

We consult the themes available in the selected area and also select one or more themes by creating an object of class `acs_5yr_topic`.

```{r}
ac |>
  get_available_area_topics("Alaska Native Regional Corporation")

act <- ac |>
  as_acs_5yr_topic("Alaska Native Regional Corporation",
                   topic = "X01 Age And Sex")
```

Once a topic has been selected, we can consult the available reports or subreports. We can focus on a report or subreport, we can also work with all the reports of the topic.

```{r}
act |>
  get_report_names()
```

We can export the reports of the selected topic to various formats such as `GeoPackage`, also `flat_table` or `star_database` of the [`rolap`](https://cran.r-project.org/package=rolap) package. In this case we are going to obtain a `GeoPackage`.

```{r}
geo <- act |>
  as_acs_5yr_geo()

dir <- tempdir()
file <- geo |>
  as_GeoPackage(dir)

sf::st_layers(file)
```

This format also allows us to perform simple queries using the metadata and the geographic layer.

```{r}
metadata <- geo |>
  get_metadata()

metadata

metadata <-
  dplyr::filter(
    metadata,
    item2 == "Female" &
      group == "People Who Are American Indian And Alaska Native Alone" &
      measure == "estimate"
  )

geo2 <- geo |>
  set_metadata(metadata)

geo2 |>
  get_metadata()

geo_layer <- geo2 |> 
  get_geo_layer()

geo_layer$faiana21vs20 <- 100 * (geo_layer$V1389 - geo_layer$V0671) / geo_layer$V0671
plot(sf::st_shift_longitude(geo_layer[, "faiana21vs20"]))
```

In `GeoPackage` format we can also easily perform queries with other tools such as *QGIS*.

Owner

  • Name: José Samos
  • Login: josesamos
  • Kind: user
  • Location: Granada
  • Company: Universidad de Granada

R / GIS / Geocomputation / DW / OLAP / Multidimensional Systems

GitHub Events

Total
Last Year

Packages

  • Total packages: 1
  • Total downloads:
    • cran 197 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
cran.r-project.org: geogenr

Generator from American Community Survey Geodatabases

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 197 Last month
Rankings
Dependent packages count: 27.8%
Dependent repos count: 36.9%
Average: 50.2%
Downloads: 85.8%
Maintainers (1)
Last synced: 7 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.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
  • data.table * imports
  • dplyr * imports
  • geomultistar * imports
  • httr * imports
  • sf * imports
  • snakecase * imports
  • starschemar * imports
  • stringr * imports
  • tibble * imports
  • tidyr * imports
  • tidyselect * imports
  • tm * imports
  • utils * imports
  • knitr * suggests
  • pander * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/pr-commands.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/pr-fetch v2 composite
  • r-lib/actions/pr-push v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • codecov/codecov-action v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite