Coder Social home page Coder Social logo

huangrh / tidycensus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from walkerke/tidycensus

0.0 1.0 0.0 5.59 MB

Load US Census boundary and attribute data as 'tidyverse' and 'sf'-ready data frames in R

Home Page: https://walkerke.github.io/tidycensus

License: Other

R 100.00%

tidycensus's Introduction

tidycensus

Build Status CRAN Badge CRAN Downloads

tidycensus is an R package that allows users to interface with the US Census Bureau's decennial Census and five-year American Community APIs and return tidyverse-ready data frames, optionally with simple feature geometry included. Install from CRAN with the following command:

install.packages("tidycensus")

Want to learn how to use tidycensus? Take the DataCamp course Analyzing US Census Data in R!

In version 0.9:

  • get_acs() now defaults to the 2013-2017 five-year American Community Survey estimates, or the 2017 1-year estimates if users set survey = "acs1".
  • Various improvements and bug fixes.

In version 0.8.1:

In version 0.4.6:

  • Bug fixed that was causing GEOIDs for some states to be converted to NA on certain Linux platforms

  • A new parameter, shift_geo, allows tidycensus users to get US state and county geometry originally obtained with the albersusa R package with Alaska and Hawaii shifted and re-scaled for better cartographic display of the entire US.

library(tidycensus)
library(tidyverse)
library(viridis)

us_county_income <- get_acs(geography = "county", variables = "B19013_001", 
                            shift_geo = TRUE, geometry = TRUE)

ggplot(us_county_income) + 
  geom_sf(aes(fill = estimate), color = NA) + 
  coord_sf(datum = NA) + 
  theme_minimal() + 
  scale_fill_viridis_c()

income_plot

Why tidycensus?

My work heavily involves the use of data from the US Census Bureau, and like many R users, I do most of my work within the tidyverse. Beyond this, the sf package now allows R users to work with spatial data in an integrated way with tidyverse tools, and updates to the tigris package provide access to Census boundary data as sf objects. Recently, I've found myself writing the same routines over and over to get Census data ready for use with tidyverse packages and sf. This motivated me to wrap these functions in a package and open-source in case other R users find them useful.

tidycensus is designed to help R users get Census data that is pre-prepared for exploration within the tidyverse, and optionally spatially with sf. To learn more about how the package works, I encourage you to read the following articles:

Future development

To keep up with on-going development of tidycensus and get even more examples of how to use the package, subscribe to my email list by clicking here (no spam, I promise!). You'll also get updates on the development of my upcoming book with CRC Press, Analyzing the US Census with R.

You can also follow my blog at https://walkerke.github.io.

My development focus is on making the current datasets as accessible as possible; if you need other approaches or datasets, I recommend the censusapi and acs packages.

If you find this project useful, you can support package development in the following ways:

Note: This product uses the Census Bureau Data API but is not endorsed or certified by the Census Bureau.

tidycensus's People

Contributors

walkerke avatar keberwein avatar mfherman avatar bfgray3 avatar arilamstein avatar tiernanmartin avatar t-kalinowski avatar

Watchers

Ren-Huai Huang 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.