2015 County FIPS Code Changes
Closed this issue · 2 comments
There were several FIPS code changes in 2015. Looks like the "regions" used in choroplethr reflect the codes for 2012-2014. Therefore, any county data that is 2015 or newer won't map.
Is there a plan to update the FIPS codes or provide a crosswalk function? I've included a reproducible example below that attempts to map data from the BLS for May 2015 as well as a hyperlink that outlines some of the recent FIPS changes.
library(dplyr)
library(choroplethr)
temp<-tempfile()
download.file("http://www.bls.gov/lau/laucntycur14.txt", temp)
df <- read.csv(temp,
fill=TRUE,header=FALSE,sep="|",skip=6,stringsAsFactors=FALSE,strip.white=TRUE)
colnames(df) <- c("area_code", "fips_state", "fips_county", "area_title", "period",
"labor_force", "employed", "unemployed", "unemployed_rate")
unlink(temp)
df$fips_county <- formatC(df$fips_county, width = 3, format = "d", flag = "0")
df$fips_state <- formatC(df$fips_state, width = 2, format = "d", flag = "0")
df$fips <- paste(df$fips_state,df$fips_county,sep="")
df <- df %>%
subset(period == "May-15" & fips_state != 72,
select = c("fips", "labor_force")) %>%
rename("region"=fips, "value"=labor_force) %>%
mutate(region = as.numeric(region)) %>%
mutate(value = as.numeric(gsub(",", "", as.character(value))))
county_choropleth(df)
Please close this issue and repost it on the arilamstein/choroplethr repo.
That's where active development is.
On Thu, Jul 28, 2016 at 6:45 PM, Keberwein notifications@github.com wrote:
There were several FIPS code changes in 2015. Looks like the "regions"
used in choroplethr reflect the codes for 2014. Therefore, any county data
that is 2015 or newer won't map. Is there a plan to update the FIPS codes
or provide a crosswalk function? I've included a reproducible example below
that attempts to map data from the BLS for May 2015 as well as a hyperlink
that outlines some of the recent FIPS changes
https://www.economy.com/support/blog/buffet.aspx?did=50094FC4-C32C-4CCA-862A-264BC890E13B
.`library(dplyr)
library(choroplethr)
temp<-tempfile()
download.file("http://www.bls.gov/lau/laucntycur14.txt", temp)
df <- read.csv(temp,fill=TRUE,header=FALSE,sep="|",skip=6,stringsAsFactors=FALSE,strip.white=TRUE)
colnames(df) <- c("area_code", "fips_state", "fips_county", "area_title",
"period",
"labor_force", "employed", "unemployed", "unemployed_rate")
unlink(temp)
df$fips_county <- formatC(df$fips_county, width = 3, format = "d", flag =
"0")
df$fips_state <- formatC(df$fips_state, width = 2, format = "d", flag =
"0")
df$fips <- paste(df$fips_state,df$fips_county,sep="")
df <- df %>%
subset(period == "May-15" & fips_state != 72,
select = c("fips", "labor_force")) %>%
rename("region"=fips, "value"=labor_force) %>%
mutate(region = as.numeric(region)) %>%
mutate(value = as.numeric(gsub(",", "", as.character(value))))county_choropleth(df)`
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#41, or mute the thread
https://github.com/notifications/unsubscribe-auth/AADGYPb-vHugE5psiWEhqCewxUK4VI-Xks5qaVtNgaJpZM4JXzVl
.
Thanks.