r - Creating a map with ggplot -


trying create heatmap of company x employees zip code on time in new york area. shapefile loads , plots correctly, , have data frame following columns: zip code, res2004, res2005, ..., res2014

shapefile

map 1 shapefile. essentially, smaller version of zip code tabulation area shapefile provided census.

data

zip_allyr data frame counts zip code year. columns are: zip_code, res2004, res2005, ..., res2014

where res2004 number of residents in given zip code in 2004.

code

library(maps) library(ggplot2)  map1 <- readshapespatial("...tristate1.shp") plot(map1) #test map shows  map2 <- fortify(map1, region="zcta5ce10") #fortify map shapefile ggplot() + geom_map(map=map2, data=zip_counts, aes(map_id=zip_code, fill=res2014)) 

this results in following error:

error in exists(name, env) : argument "env" missing, no default 

can let me know missing?

edit 1: added shapefile , data descriptions


Comments