-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_data.R
32 lines (30 loc) · 1.25 KB
/
create_data.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# library(foreign)
# ess <- read.dta("~/data/ess/integr_ed20_round6/ESS6e02.dta")
# save(ess, file="~/data/ess/integr_ed20_round6/ESS6e02.rda")
# Load Ess data
# liitetään maiden suomenkieliset nimet ja regiimien nimet
# library(RCurl)
# GHurl <- getURL("https://raw.githubusercontent.com/muuankarski/data/master/world/countries_continents.csv")
# dat <- read.csv(text = GHurl)
# dat <- dat[!duplicated(dat[c("cCode2")]),]
# ess <- merge(ess,dat,
# by.x="cntry",
# by.y="cCode2",
# all.x=TRUE)
# save(ess, file="data/ess.rda")
# load(url("http://koti.kapsi.fi/~muuankarski/avoin-suomi/ess.rda"))
# load EU country shapefile from GISco
# download.file("http://epp.eurostat.ec.europa.eu/cache/GISCO/geodatafiles/CNTR_2010_20M_SH.zip",
# destfile="zipfile")
# unzip("zipfile")
# library(rgdal)
# # read into SpatialPolygonsDataFrame
# map <- readOGR(dsn = "./CNTR_2010_60M_SH/data", layer = "CNTR_RG_60M_2010")
# library(ggplot2)
# library(rgeos)
# map <- gBuffer(map, width=0, byid=TRUE)
# map$id <- rownames(map@data)
# map.points <- fortify(map, region = "id")
# map.df <- merge(map.points, map, by = "id")
# save(map.df, file="map.df.rda")
# load(url("http://koti.kapsi.fi/~muuankarski/avoin-suomi/map.df.rda"))