Created
July 21, 2016 18:43
-
-
Save anonymous/7b178737d17f97e10aa0105722dc033b to your computer and use it in GitHub Desktop.
R-code für die C1/4h über Datenvisualisierung von Karten-Daten.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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