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


You can install the development version from GitHub with:

# install.packages("devtools")


Load the package:

Download and read data with:

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

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


Then the path can be recovered with:

path12 <- Sys.getenv('ppmf12')

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[] <- 0