Skip to content

Instantly share code, notes, and snippets.

View gergness's full-sized avatar

Greg Freedman Ellis gergness

  • crunch.io
  • St Paul, MN
View GitHub Profile
suppressPackageStartupMessages({
    library(covdata)
    library(dplyr)
    library(ggplot2)
    library(geofacet)
    library(glue)
})
pop_state <- uspop %>%
    filter(sex_id == "totsex" & hisp_id == "tothisp") %>%
This is I think closest to what was described, however it holds all of the data in memory still...
``` r
library(ipumsr)
ddi <- read_ipums_ddi(ipums_example("cps_00006.xml"))
# (These are just the names for an extract included with ipumsr - they stand in for
# REPWT1-REPWT40, REPWT41-REPWT80, etc.)
var_groups <- list(
HH_RE1 = tidyselect::vars_select(ddi$var_info$var_name, YEAR:SERIAL),
@gergness
gergness / nhgis_cartogram.R
Created July 20, 2018 18:49
Animated cartograms with NHGIS data
library(purrr)
library(ipumsr) # requires development version: devtools::install_github("mnpopcenter/ipumsr")
library(rmapshaper)
library(ggplot2)
library(gganimate) # devtools::install_github("thomasp85/gganimate")
library(stringr)
library(dplyr)
library(tidyr)
library(cartogram)
library(sf)
@gergness
gergness / ipumsr-bigdata.html
Last active July 16, 2018 18:33
ipumsr big data vignette
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="pandoc">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Minnesota Population Center">
@gergness
gergness / ipumsr-bigdata.html
Created July 9, 2018 18:49
ipumsr big data vignette
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
Hitting an error with transformr, not sure if I'm specifying it wrong though...
``` r
library(tidycensus)
library(rmapshaper)
library(cartogram)
library(sf)
#> Linking to GEOS 3.6.1, GDAL 2.2.3, proj.4 4.9.3
library(transformr)
library(ggplot2)
@gergness
gergness / gist.html
Created November 20, 2017 19:28
Introducing ipumsr
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
@gergness
gergness / survey_arrange.Rmd
Last active October 12, 2017 15:18
Exploring arrange with survey data
``` r
suppressPackageStartupMessages({
library(survey)
library(srvyr)
library(dplyr)
})
# stratified sample from examples
data(api)
dstrata <- apistrat %>%
as_survey(strata = stype, weights = pw)