Skip to content

Instantly share code, notes, and snippets.

Kyle Walker walkerke

Block or report user

Report or block walkerke

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View iowa_roads.R
library(tigris)
library(tidyverse)
options(tigris_class = "sf")
# Get a vector of county codes
ia_counties <- counties("IA", cb = TRUE, resolution = "20m") %>%
pull(COUNTYFP)
# Iterate through the county codes and combine the result
ia_roads <- map(ia_counties, ~{
View dc-race-datacamp.R
library(tidycensus)
library(tidyverse)
library(sf)
racevars <- c(White = "P005003",
Black = "P005004",
Asian = "P005006",
Hispanic = "P004003")
race <- get_decennial(geography = "tract", variables = racevars,
View williams_pyramid.R
library(tidycensus)
library(tidyverse)
library(gganimate)
williams <- get_estimates(geography = "county",
product = "characteristics",
breakdown = c("AGEGROUP", "SEX"),
breakdown_labels = TRUE,
state = "ND",
county = "Williams",
View county_subdivisions.R
library(tigris)
library(tidycensus)
library(tidyverse)
library(sf)
ma_income <- get_acs(geography = "county subdivision",
variables = "B19013_001",
state = "MA")
ma_subs <- county_subdivisions(state = "MA", cb = TRUE, class = "sf") %>%
View mapdeck_housing.R
library(tidycensus)
library(mapdeck)
library(tidyverse)
token <- "your mapbox token"
hv <- get_acs(geography = "tract",
variables = "B25077_001",
state = "CA",
geometry = TRUE) %>%
View austin_distance.R
library(tidycensus)
library(tigris)
library(tidyverse)
library(sf)
library(extrafont)
options(tigris_use_cache = TRUE, tigris_class = "sf")
########################################################################
########################################################################
# Chart 1
View nigeria_tfr.R
library(rnaturalearth)
library(sf)
library(plotly)
library(crosstalk)
library(viridis)
ng <- ne_states(country = "Nigeria", returnclass = "sf") %>%
select(Name = name)
# Source: https://dhsprogram.com/pubs/pdf/FR293/FR293.pdf
@walkerke
walkerke / make_GeodesicBuffer.R
Last active Apr 12, 2018 — forked from valentinitnelav/make_GeodesicBuffer.R
Geodesic buffer for point data
View make_GeodesicBuffer.R
make_GeodesicBuffer <- function(XY.dg, dg.step=5, dst.m, crs){
#######################################################################################################
## Function to make a circle-buffer around given points (long-lat coordinates)
## Is different from rgeos::gBuffer() by the fact that it allows the user to create
## a geodesic buffer with a width expressed in metric units.
## Otherwise the user needs to project and apply an Euclidian buffer with rgeos::gBuffer(),
## which will introduce distortions that vary greatly with latitude and the radius of the circle buffer.
## See also my question addressed here:
## https://gis.stackexchange.com/questions/250389/euclidean-and-geodesic-buffering-in-r
##
View alltracts.R
library(tigris)
library(tidyverse)
options(tigris_use_cache = TRUE)
st <- c(state.abb, "DC")
alltracts <- map(st, function(x) {
tracts(state = x, cb = TRUE, class = "sf")
}) %>%
rbind_tigris()
View montreal-dots.R
library(cancensus)
library(tidyverse)
library(sf)
library(tmap)
library(tmaptools)
options(cancensus.api_key = "your key goes here")
montreal <- get_census(dataset = "CA16", regions = list(CMA = "24462"),
vectors = c("v_CA16_1364", "v_CA16_1367"), level = "CT",
geo_format = "sf", labels = "short")
You can’t perform that action at this time.