SurvMapper2: Map your prepared data with SurvMapper2

Description Usage Arguments Author(s) Examples

Description

Later version of SurvMapper. Creates surveillance chloropleth maps for data prepared with PrepMap. Note that due to the use of grid for legend and the small inlets for non-visible countries, mapping is not superswift and elements appear one by one to the graph. Also, the alignment of the legend, as well as fontsize depends on the width x height. Current ideal dimensions approximately 1000x680. Currently uses 'Tahoma' font, but needs care with the registration of fonts with extrafont. Map function best used with get_GEO_data and PrepMap, i.e. geographical data predefined in a certain way.

Usage

1
2
3
4
5
SurvMapper2(data, fills, long = "long", lat = "lat", id = "id",
  GEO_ID = "GEO_ID", bground = "isEEA", Legend_title, col_scale,
  fill_levels = NULL, reverse_colours = FALSE,
  not_included = "Not included", add_points = FALSE,
  pointdata = NULL, pointsize = NULL, pointshape = "*")

Arguments

data

Your spatial data that you want to map, prepared to work with ggplot2, currently only chloropleth available

fills

Your column/variable(s) that your want to map. Preferably a factor in defined order.

long

Your longitude variable, defaults to 'long'

lat

Your latitude variable, defaults to 'lat'

id

Your spatial id variable, defaults to 'id'

GEO_ID

Your spatial id variable (e.g. country code), defaults to 'GEO_ID'

bground

Your variable with 1/0 to classify the grey background (0's included only in lightgrey), defaults to 'isEEA'

Legend_title

Legend title(s). More than one if more than one fills. Use escape new line to split the legend to several rows.

col_scale

Colour scale, use 'green', 'red', 'blue' or 'qualitative'. Note that the last category is always "No data" grey. More than one if more than one fills.

fill_levels

The order to map the levels in fills; only works with one fills variable.

reverse_colours

Reverse the order of the colour scale. Note that the last category/ies are always "No data" and "Not included" grey (the latter can be omitted).

not_included

Label for the background colour category for the legend, defaults to "Not included". Use NULL to omit the "Not included" category from the legend.

Author(s)

Tommi Karki

Examples

 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
# load the included dummy data
load(system.file("extdata", "dummy_data.rds", package = "SurvMaps"))
# Get the EU/EEA and candidate country SpatialPolygonsDataframe, including a variable "isEEA"
plg_map <- get_GEO_data(layer = 1, STAT_LEVL = c(0), FIELDS = c("isEEA", "GEO_ID"))

# Prepare the data for SurvMapper with PrepMap
mymap <- PrepMap(data = dummy_data , geo = plg_map)

# The map is correctly aligned only for selected width/height, so you can plot into a predefined device
dev.new(width=11.8,height=8, noRStudioGD = TRUE)

# Simple chloropleth map
SurvMapper2(mymap, fills ="Dummy_status", Legend_title = "Testing this", col_scale = "red")

# Simple chloropleth map with other options
SurvMapper2(mymap, fills ="Dummy_status", Legend_title = "Testing this", col_scale = "red")

# Chloropleth map with some additional options
SurvMapper2(mymap, fills ="Dummy_status", Legend_title = "Testing this", 
       fill_levels = c("Dummy4",
                       "Dummy3",
                       "Dummy2", 
                       "Dummy1",
                       "No data"),
       col_scale = "hotcold", reverse_colours = TRUE, not_included = NULL)

# Note that you can map at once several columns, but all options are not yet available for this scenario - 
# e.g. level order is good to be predefined if plotting several columns. And depends on graphical device (e.g. recording)
SurvMapper(mymap, fills = c("Dummy_status", "Dummy2"), Legend_title = c("Testing this", "And also this"),
       col_scale = c("blue", "qualitative"))

TommiKarki/SurvMaps documentation built on May 31, 2019, 10:45 p.m.