Skip to content

Instantly share code, notes, and snippets.

@dataspam
dataspam / global_slavery_index-2013-tips.r
Created Jun 3, 2014
Global Slavery Rates (from Global Slavery & US State Department)
View global_slavery_index-2013-tips.r
SlaveryData <- read.csv("data/global_slavery_index_2013-transformed.csv")
library(ggplot2)
library(rgeos)
library(maptools)
library(extrafont)
# font_import() only needs to be done once and I've already done it
loadfonts(device = "win")
map.world <- readShapeSpatial("maps/world/ne_110m_admin_0_countries.shp")
plot(map.world)
# I'm a dummy who used the sov_a3 region rather than the adm0_a3 region;
View persistent_poverty.r
# colClasses forces the FIPSFULL row to keep their leading zeros
PerPovData <- read.csv("data/persistent_poverty-full.csv", colClasses=c("FIPSFULL"="character"))
library(rgeos)
library(maptools)
#Prep Continental Map
fips_dist <- readShapeSpatial("maps/fips/basic/US_County_AK_2000_2004.shp")
# if you want to check to see if it plots correctly: plot(fips_dist), but I know this is working for me
fips_dist <- fortify(fips_dist, region = "FIPS")
fips_dist$id <- toupper(fips_dist$id)
#Prep Alaska and Hawaii Map