GithubHelp home page GithubHelp logo

elipousson / ipumseasyr Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 3.18 MB

Easy access to IPUMS data using {ipumsr}

Home Page: https://elipousson.github.io/ipumseasyr/

License: Other

R 100.00%
ipums ipums-api r-package

ipumseasyr's Introduction

ipumseasyr

Lifecycle: experimental License: MIT Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.

The goal of ipumseasyr is to ease access to the IPUMS data (especially NHGIS data) with easy-to-use wrappers for the {ipumsr} package.

Installation

You can install the development version of ipumseasyr from GitHub:

# pak::pkg_install("elipousson/ipumseasyr")

Example

library(ipumseasyr)

Define an extract without submitting it:

state_population_extract <- define_nhgis_ts_extract(
  year = seq(1990, 2010, by = 10),
  tables = "CL8",
  geography = "state"
)

state_population_extract
#> Unsubmitted IPUMS NHGIS extract 
#> Description: 
#> 
#> Time Series Table: CL8
#>   Geog Levels: state
#>   Years: 1990, 2000, 2010

Get an extract (using an extract from my extract history):

nhgis_extracts <- get_nhgis_extract_history()

withr::with_tempdir({
  state_population <- get_nhgis_ts_data(
    extract = nhgis_extracts[[1]]
  )

  dplyr::glimpse(state_population)
})
#> Successfully submitted IPUMS NHGIS extract number 30
#> Checking extract status...
#> Waiting 10 seconds...
#> Checking extract status...
#> Waiting 20 seconds...
#> Checking extract status...
#> IPUMS NHGIS extract 30 is ready to download.
#>   |                                                                              |                                                                      |   0%  |                                                                              |====                                                                  |   6%  |                                                                              |==========                                                            |  15%  |                                                                              |===================================                                   |  50%  |                                                                              |======================================================================| 100%
#> Data file saved to /private/var/folders/3f/50m42dx1333_dfqb5772j6_40000gn/T/RtmpUu23eI/file450974b29832/nhgis0030_csv.zip
#> Use of data from NHGIS is subject to conditions including that users should cite the data appropriately. Use command `ipums_conditions()` for more details.
#> Rows: 9419 Columns: 10
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (8): GISJOIN, STATE, STATEFP, STATENH, COUNTY, COUNTYFP, COUNTYNH, NAME
#> dbl (2): YEAR, A00AA
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Use of data from NHGIS is subject to conditions including that users should cite the data appropriately. Use command `ipums_conditions()` for more details.
#> 
#> Rows: 153 Columns: 7
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (5): GISJOIN, STATE, STATEFP, STATENH, NAME
#> dbl (2): YEAR, A00AA
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Rows: 9,572
#> Columns: 11
#> $ filename <chr> "nhgis0030_csv/nhgis0030_ts_nominal_county.csv", "nhgis0030_c…
#> $ GISJOIN  <chr> "G0100010", "G0100030", "G0100050", "G0100070", "G0100090", "…
#> $ YEAR     <dbl> 1980, 1980, 1980, 1980, 1980, 1980, 1980, 1980, 1980, 1980, 1…
#> $ STATE    <chr> "Alabama", "Alabama", "Alabama", "Alabama", "Alabama", "Alaba…
#> $ STATEFP  <chr> "01", "01", "01", "01", "01", "01", "01", "01", "01", "01", "…
#> $ STATENH  <chr> "010", "010", "010", "010", "010", "010", "010", "010", "010"…
#> $ COUNTY   <chr> "Autauga County", "Baldwin County", "Barbour County", "Bibb C…
#> $ COUNTYFP <chr> "001", "003", "005", "007", "009", "011", "013", "015", "017"…
#> $ COUNTYNH <chr> "0010", "0030", "0050", "0070", "0090", "0110", "0130", "0150…
#> $ NAME     <chr> "AUTAUGA COUNTY", "BALDWIN COUNTY", "BARBOUR COUNTY", "BIBB C…
#> $ A00AA    <dbl> 32259, 78556, 24756, 15723, 36459, 10596, 21680, 119761, 3919…

ipumseasyr's People

Contributors

elipousson avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.