global_map: Generate a global map for a single variable.

Description Usage Arguments Value Examples

View source: R/map.R

Description

This general purpose function can be used to generate a global map for a single variable. It has few defaults but the data supplied must contain a country variable for linking to mapping data. This function requires the installation of the rnaturalearth package.

Usage

1
2
3
4
5
6
7
8
9
global_map(
  data = NULL,
  variable = NULL,
  variable_label = NULL,
  trans = "identity",
  fill_labels = NULL,
  scale_fill = NULL,
  ...
)

Arguments

data

Dataframe containing variables to be mapped. Must contain a country variable.

variable

A character string indicating the variable to map data for. This must be supplied.

variable_label

A character string indicating the variable label to use. If not supplied then the underlying variable name is used.

trans

A character string specifying the transform to use on the specified metric. Defaults to no transform ("identity"). Other options include log scaling ("log") and log base 10 scaling ("log10"). For a complete list of options see ggplot2::continous_scale.

fill_labels

A function to use to allocate legend labels. An example (used below) is scales::percent, which can be used for percentage data.

scale_fill

Function to use for scaling the fill. Defaults to a custom ggplot2::scale_fill_manual

...

Additional arguments passed to the scale_fill function

Value

A ggplot2 object containing a global map.

Examples

1
2
3
4
5
6
## Not run: 
df <- data.table::data.table(variable = "Increasing", country = "France") 

global_map(df, variable = "variable")

## End(Not run)

epiforecasts/EpiNow documentation built on Oct. 26, 2020, 2:38 p.m.