create_choropleth: Create A Choropleth Map

Description Usage Arguments Value See Also Examples

Description

This function will create a choropleth map of the European Union and some of its (perspective) member candidates, the EEA countries, and the United Kingdom. The geographical information must conform the official geo codes of Eurostat.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
create_choropleth(
  dat,
  n = 5,
  geo_var = "geo",
  values_var = "values",
  type = "discrete",
  show_all_missing = TRUE,
  unit_text = NULL,
  color_palette = NULL,
  na_color = "grey93",
  drop_levels = FALSE,
  reverse_scale = FALSE,
  style = "pretty",
  print_style = "min-max",
  iceland = "if_present"
)

Arguments

dat

Eurostat data frame or a data frame derived from create_indicator or create_tables.

n

Number of colour categories if discrete (categorical) colouring is chosen, defaults to 5.

geo_var

The name of the variable that contains the standard geo codes. It defaults to "geo".

values_var

The name of the variable that contains the values To be mapped. It defaults to "values". If the data you want to see on map is in the column average_values, than use "average_values". The values can be numeric or categorical variables.

type

Defaults to 'discrete' for coloring discrete (categorical) values, can be set to 'numeric' for continous numeric values.

show_all_missing

Defaults to TRUE when all regions with missing values are explicitly shown in the map. FALSE shows only missing observations in dat. For example, if your dataset contains observations on European Union regions, than it will not contain an NA value or Norwegian regions in the case of FALSE.

unit_text

Defaults to NULL. The title caption of the color (fill) legend.

color_palette

A named character vector with colors. If you use this with categorical variables, make sure that the color_palette has a value for each categories except for missing values, and it is named to the category name (factor level) as it is found in you values_var.

na_color

Defaults to "grey93". This color will be used in the color palette for missing values, unless you have explicitly set one of the names of the palette to "missing".

drop_levels

Weather to drop categorical levels on the choropleth if they are not present in the data. Defaults to FALSE.

reverse_scale

Defaults to FALSE.

style

Style of interval reporting, defaults to "pretty". Style can be one of "fixed", "sd", "equal", "pretty", "quantile", "kmeans", "hclust", "bclust", "fisher", "jenks" or "dpih".

print_style

Style of printing the labels, defaults to "min-max". Alternative is "interval"

iceland

Show Iceland on the choropleth? Defaults to "if_present", which shows Iceland if Icelandic data is present.

Value

A ggplot object with a choropleth map.

The function returns a ggplot2 object. You can modify the ggplot object, for example, with adding labs.

See Also

indicator_categories

Examples

1
2
3
4
5
6
## Not run: 
chreate_choropleth ( your_nuts2_data, level=2, n=5, style="kmeans") +
 labs (title = "Your Title", fill = "fill legend name",
       subtitle = "Your Subtitle", caption ="Your caption or footnote.")

## End(Not run)

antaldaniel/satellitereport documentation built on Aug. 7, 2020, 8:37 a.m.