.
countries SpatialPolygonsDataFrame 177 ( 177 countries@data). left_join countries@data df, countries , countries@data 210.
countries broom::tidy countries 177 id, 0 176. ( , , ).
id countries@data rownames(countries@data), , id 1 210, countries@data df. , .
:
countries.t = tidy(countries, region = "name")
countries.t = left_join(countries.t, countries@data, by = c("id" = "name"))
countries.t = left_join(countries.t, df, by = c("iso_a2" = "country_code"))
ggplot(data = countries.t,
aes(long, lat, fill = country_name, group = group)) +
geom_polygon() +
geom_path(colour="black", lwd = 0.05) +
coord_equal() +
ggtitle("Data and geometry are fine") +
theme(axis.text = element_blank(),
axis.title = element_blank(),
axis.ticks = element_blank())

p.s. ggmap. ggplot2, .