Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View code.R
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
library(maps)
 
unemp <- read.csv('unemployment09.csv',header=FALSE, stringsAsFactors=FALSE,
col.names=c("blsid", "stfips", "cofips", "name", "year", "pop1", "pop2", "unempraw", "unemppct"))
 
unemp$mpname <- tolower(paste(state.name[match(sub("^.*([A-Z][A-Z])$","\\1",unemp$name,fixed=FALSE),state.abb)],
sub("^(.*) (County|[Cc]ity|Parish), ..$","\\1", unemp$name),sep=","))
 
unemp$ri <- as.numeric(cut(unemp$unemppct,c(seq(0,10,by=2),max(unemp$unemppct))))
 
cols <- c("#F1EEF6", "#D4B9DA", "#C994C7", "#DF65B0", "#DD1C77", "#980043")
 
mp <- map("county", plot=FALSE,namesonly=TRUE)
 
map("county", col=cols[unemp[match(mp,unemp$mpname),]$ri],fill=TRUE)
m-a-j commented

Hi.

I came across this page via the chloropleth challenge page. I've not yet understood all of the code above, but as you surely put a lot of effort into the challenge, I'd still like to ask you one question:
In the meantime, have you found one package that was particularly useful for displaying (and generally working with) maps in R? Or have you spent more time on developping your own maps-related projects?
I'm asking because I'd like to work with maps in the near future and I'm still not sure which package to use.

Cheers,
Markus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.