MyNixOS website logo
Description

Read Census Privacy Protected Microdata Files.

Implements data processing described in <doi:10.1126/sciadv.abk3283> to align modern differentially private data with formatting of older US Census data releases. The primary goal is to read in Census Privacy Protected Microdata Files data in a reproducible way. This includes tools for aggregating to relevant levels of geography by creating geographic identifiers which match the US Census Bureau's numbering. Additionally, there are tools for grouping race numeric identifiers into categories, consistent with OMB (Office of Management and Budget) classifications. Functions exist for downloading and linking to existing sources of privacy protected microdata.

ppmf

R-CMD-check

The goal of ppmf is to convert Census Privacy Protected Microdata Files into somewhat wider data aggregated to a geographic level.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("christopherkenny/ppmf")

Basics

Load the package:

library(ppmf)

Download and read data with:

path <- download_ppmf(dsn = 'filename.csv', dir = 'some/directory', version = '19')
al <- read_ppmf(state = 'AL', path = path)

Version ‘19’ reflects the 19.61 finalized parameters used again for the 2020 Census.

For future use, I recommend storing the path to the data for future sessions using:

add_pmmf19_path(path)

Then the path can be recovered with:

path19 <- Sys.getenv('ppmf19')

Once you’ve read in what you want, you can aggregate it to the right level:

al <- al %>% add_geoid()
blocks <- agg(al)

And aggregated data can use the GEOID to merge with shapefiles:

library(dplyr) # to clean up the data

shp <- tigris::blocks('AL', year = 2010) %>% 
  select(GEOID10, geometry) %>% rename(GEOID = GEOID10)
shp <- shp %>% left_join(blocks, by = 'GEOID')

# always clean shp!
shp[is.na(shp)] <- 0

For users with the newest package version, there is an added dependency on censable, which allows for an easier workflow. If you’ve used the add_pmmf*_path() workflow suggested, you don’t even need to supply the paths!

This will not just read the ppmf data, it will merge it with 2010 Census populations (by major race/ethnicity grouping) and add the corresponding geometries.

al <- read_merge_ppmf('AL', level = 'block', versions = '19')
Metadata

Version

0.1.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows