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(memisc) | |
library(assertthat) | |
library(sqldf) | |
library(magrittr) | |
library(dplyr) | |
library(reshape2) | |
library(ggplot2) | |
library(oz) | |
library(scatterpie) |
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
map_data(map, region = ".", exact = FALSE, ...) |
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
borders(database = "world", regions = ".", fill = NA, | |
colour = "grey50", xlim = NULL, ylim = NULL, ...) |
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
readOGR(dsn, layer, verbose = TRUE, p4s=NULL, | |
stringsAsFactors=default.stringsAsFactors(), | |
drop_unsupported_fields=FALSE, | |
pointDropZ=FALSE, dropNULLGeometries=TRUE, | |
useC=TRUE, disambiguateFIDs=FALSE, addCommentsToPolygons=TRUE, | |
encoding=NULL, use_iconv=FALSE, swapAxisOrder=FALSE, require_geomType = NULL, | |
integer64="no.loss", GDAL1_integer64_policy=FALSE) |
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
fortify(model, data, ...) |
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
# Using borders() | |
mapplot2 <- ggplot(data = final_data, aes(x=longitude, y=latitude), group = country) + | |
borders("world", colour="gray50", fill="gray50") | |
mapplot2 |
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
# Using shapefile / geom_polygon | |
SHAPE_FILE_PATH = "./Data/World_Countries/World_Countries.shp" | |
world <- readOGR(dsn = SHAPE_FILE_PATH) | |
world <- fortify(world) | |
mapplot3 <- ggplot(data = world, aes(long, lat, group=group)) + | |
geom_polygon(color = "white", fill = "gray50") | |
mapplot3 |
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
# Using map_data() | |
worldmap <- map_data ("world") | |
mapplot1 <- ggplot(worldmap) + | |
geom_map(data = worldmap, map = worldmap, aes(x=long, y=lat, map_id=region), col = "white", fill = "gray50") + | |
geom_scatterpie(aes(x=longitude, y=latitude, group = country, r = multiplier*6), | |
data = final_data, cols = colnames(final_data[,c(2:11)])) | |
mapplot1 |
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
# Using map_data() | |
worldmap <- map_data ("world") | |
mapplot1 <- ggplot(worldmap) + | |
geom_map(data = worldmap, map = worldmap, | |
aes(x=long, y=lat, map_id=region), col = "white", fill = "gray50") | |
mapplot1 |
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
# Using map_data() | |
worldmap <- map_data ("world") | |
mapplot1 <- ggplot(worldmap) + | |
geom_map(data = worldmap, map = worldmap, aes(x=long, y=lat, map_id=region), col = "white", fill = "gray50") + | |
geom_scatterpie(aes(x=longitude, y=latitude, group = country, r = multiplier*6), | |
data = final_data, cols = colnames(final_data[,c(2:11)])) + | |
xlim(-20,60) + ylim(10, 75) + | |
scale_fill_brewer(palette = "Paired") + | |
geom_text(aes(x=longitude, y=latitude, group = country, label = country), data = final_data, stat = "identity", |
OlderNewer