get_map: Creates a map that shows which is the most voted political...

Description Usage Arguments Value Examples

View source: R/get_map.R

Description

Creates a categorical map based on the dataframe assigned to argument data and the column asigned to fill_by. The map uses projection epsg:3035, so the map is already focused to the region of the European Union using an equal area Azimuthal projection.

Usage

1
get_map(data, fill_by = NULL, legend = "", title = "")

Arguments

data

The dataframe with the polygon data and other data.

fill_by

The column that with the desired categories.

legend

The string to be used as legend of the map.

title

The string to be used as title of map.

Value

Plots a categorical map using epsg: 3035 as a projection (Azimuthal equal area focused on the European Union) showing the values of the selected column from the selected dataframe.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Country <- c("Austria", "Belgium", "Bulgaria", "Croatia")
EPP <- c(1,2,3,4)
SD <- c(4,1,2,3)
Other <- c(3,4,1,2)
IN <- c(2,3,4,1)
Bias <- c("SD", "Other", "IN", "EPP")
df.data <- data.frame(Country, EPP, SD, Other, IN, Bias)
library("rnaturalearth")
library("rnaturalearthdata")
library("ggplot2")
world <- ne_countries(scale = "medium", returnclass = "sf")

t_world <- merge(world, df.data, by.x="name_long", by.y="Country")

get_map(t_world, t_world$Bias, legend = "Sample Legend", title = "Major Parties")

bclroger/euparliament documentation built on Jan. 26, 2020, 12:56 a.m.