I am trying to replicate the example provided in the micromap R package of a linked map with the poverty rate for the 50 US states. I am trying to achieve the same results with a Shapefile from Germany. Here is my code:
library(micromap)
library(ggplot2)
setwd ('C:/Users/Jesus/Dropbox/linked maps/Chapter4')
ger<-readShapePoly("germany3.shp")
edPov<-read.csv('gerpoverty.csv')
statePolys <- create_map_table(ger, 'VARNAME_1')
head(statePolys)
lmplot(stat.data=edPov,
map.data=statePolys,
panel.types=c('labels', 'dot','map'),
panel.data=list('Id1','poverty',NA),
ord.by='poverty',
grouping=5, median.row=F,
map.link=c('Id1','VARNAME_1'))
When I tried to parse it into a flat table for use with ggplot2 the procedure does not work (instead of having 16 observations it has 8000 plus observations). Also when I try to plot the linked map, the following error appears on screen:
Error in `[.data.frame`(DF, , ord.by) : undefined columns selected
Here is the link to the files in a zip file:
https://www.dropbox.com/s/c43k755aadvu2z6/germany.rar
Any ideas or suggestions?
Thanks,