Skip to content

Instantly share code, notes, and snippets.

/Map.R

Created Jul 21, 2016
Embed
What would you like to do?
R-code für die C1/4h über Datenvisualisierung von Karten-Daten.
rm(list = ls())
library(ggplot2)
library(dplyr)
setwd("~/Projekte/R/EU-Internet/")
d <- read.csv("./internet.csv")
View(d)
ggplot(d, aes(geo, X2013, fill = indic_is)) +
geom_bar(stat = "Identity") +
facet_wrap(~indic_is)
library(rworldmap)
world <- map_data("world") %>%
select(lon=long, lat, group, id = region)
View(world)
names <- read.csv("./countries.csv")
View(names)
d <- inner_join(d, names, by = c("geo" = "ExpCountry"))
d <- inner_join(d, world, by = c("ExpCountryCaption" = "id"))
members <- read.csv("./members_eu.csv")
View(members)
d <- inner_join(d, members, by = c("ExpCountryCaption" = "Country"))
d$X2010 = as.numeric(d$X2010)
ggplot(d, aes(lon, lat)) +
geom_polygon(aes(group = group, fill = X2010),
colour = "grey50") +
facet_wrap(~indic_is) +
coord_quickmap()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.