Package 'csmaps'

Title: Preformatted Maps of Norway that Don't Need Geolibraries
Description: Provides datasets containing preformatted maps of Norway at the county, municipality, and ward (Oslo only) level for redistricting in 2024, 2020, 2018, and 2017. Multiple layouts are provided (normal, split, and with an insert for Oslo), allowing the user to rapidly create choropleth maps of Norway without any geolibraries.
Authors: Richard Aubrey White [aut, cre] , Chi Zhang [aut] , CSIDS [cph]
Maintainer: Richard Aubrey White <[email protected]>
License: MIT + file LICENSE
Version: 2023.5.25
Built: 2025-01-24 05:13:25 UTC
Source: https://github.com/csids/csmaps

Help Index


Maps of Norwegian counties in data.table format

Description

We conveniently package map datasets for Norwegian counties (taken from Geonorge) that can be used in ggplot2 without needing any geo libraries. This data is licensed under Creative Commons BY 4.0 (CC BY 4.0).

Usage

nor_county_map_b2024_default_dt

nor_county_map_b2020_default_dt

nor_county_map_b2019_default_dt

nor_county_map_b2017_default_dt

nor_county_position_geolabels_b2024_default_dt

nor_county_position_geolabels_b2020_default_dt

nor_county_position_geolabels_b2019_default_dt

nor_county_position_geolabels_b2017_default_dt

Format

long

Location code.

lat

Location name.

order

The order that this line should be plotted in.

group

Needs to be used as 'group' aesthetic in ggplot2.

location_code

Location code (municipality code).

An object of class data.table (inherits from data.frame) with 4479 rows and 5 columns.

An object of class data.table (inherits from data.frame) with 4722 rows and 5 columns.

An object of class data.table (inherits from data.frame) with 4531 rows and 5 columns.

An object of class data.table (inherits from data.frame) with 15 rows and 4 columns.

An object of class data.table (inherits from data.frame) with 11 rows and 4 columns.

An object of class data.table (inherits from data.frame) with 18 rows and 4 columns.

An object of class data.table (inherits from data.frame) with 19 rows and 4 columns.

Details

Borders for 2024, 2020, 2019, and 2017 are provided.

Examples

# 2024 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_county_map_b2024_default_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

# 2020 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_county_map_b2020_default_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

# 2019 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_county_map_b2019_default_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

# 2017 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_county_map_b2017_default_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

Maps of Norwegian municipalities in sf format

Description

This data is licensed under Creative Commons BY 4.0 (CC BY 4.0).

Usage

nor_county_map_b2024_default_sf

nor_county_map_b2020_default_sf

nor_county_map_b2019_default_sf

nor_county_map_b2017_default_sf

Format

geometry

Multipolygon

location_code

Location code (municipality code).

An object of class sf (inherits from data.frame) with 11 rows and 2 columns.

An object of class sf (inherits from data.frame) with 18 rows and 2 columns.

An object of class sf (inherits from data.frame) with 19 rows and 2 columns.

Details

Borders for 2024, 2020, 2019, and 2017 are provided.


Maps of Norwegian counties with an insert for Oslo in data.table format

Description

We conveniently package map datasets for Norwegian counties (taken from Geonorge) that can be used in ggplot2 without needing any geo libraries. This data is licensed under Creative Commons BY 4.0 (CC BY 4.0).

Usage

nor_county_map_b2024_insert_oslo_dt

nor_county_map_b2020_insert_oslo_dt

nor_county_map_b2019_insert_oslo_dt

nor_county_map_b2017_insert_oslo_dt

nor_county_position_geolabels_b2024_insert_oslo_dt

nor_county_position_geolabels_b2020_insert_oslo_dt

nor_county_position_geolabels_b2019_insert_oslo_dt

nor_county_position_geolabels_b2017_insert_oslo_dt

Format

long

Location code.

lat

Location name.

order

The order that this line should be plotted in.

group

Needs to be used as 'group' aesthetic in ggplot2.

location_code

Location code (county code).

An object of class data.table (inherits from data.frame) with 4537 rows and 5 columns.

An object of class data.table (inherits from data.frame) with 4780 rows and 5 columns.

An object of class data.table (inherits from data.frame) with 4589 rows and 5 columns.

An object of class data.table (inherits from data.frame) with 15 rows and 4 columns.

An object of class data.table (inherits from data.frame) with 11 rows and 4 columns.

An object of class data.table (inherits from data.frame) with 18 rows and 4 columns.

An object of class data.table (inherits from data.frame) with 19 rows and 4 columns.

Details

Borders for 2024, 2020, 2019, and 2017 are provided.

Examples

# 2024 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_county_map_b2024_insert_oslo_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + annotate(
  "text",
  x = csmaps::nor_xxx_position_title_insert_oslo_b2024_insert_oslo_dt$long,
  y = csmaps::nor_xxx_position_title_insert_oslo_b2024_insert_oslo_dt$lat,
  label = "Oslo"
)
q <- q + theme_void()
q <- q + coord_quickmap()
q


# 2020 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_county_map_b2020_insert_oslo_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + annotate(
  "text",
  x = csmaps::nor_xxx_position_title_insert_oslo_b2020_insert_oslo_dt$long,
  y = csmaps::nor_xxx_position_title_insert_oslo_b2020_insert_oslo_dt$lat,
  label = "Oslo"
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

# 2019 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_county_map_b2019_insert_oslo_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + annotate(
  "text",
  x = csmaps::nor_xxx_position_title_insert_oslo_b2019_insert_oslo_dt$long,
  y = csmaps::nor_xxx_position_title_insert_oslo_b2019_insert_oslo_dt$lat,
  label = "Oslo"
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

# 2017 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_county_map_b2017_insert_oslo_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + annotate(
  "text",
  x = csmaps::nor_xxx_position_title_insert_oslo_b2017_insert_oslo_dt$long,
  y = csmaps::nor_xxx_position_title_insert_oslo_b2017_insert_oslo_dt$lat,
  label = "Oslo"
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

Split map of Norwegian counties in data.table format

Description

We conveniently package map datasets for Norwegian counties (taken from Geonorge) that can be used in ggplot2 without needing any geo libraries. This data is licensed under Creative Commons BY 4.0 (CC BY 4.0).

Usage

nor_county_map_b2024_split_dt

nor_county_map_b2020_split_dt

nor_county_position_geolabels_b2024_split_dt

nor_county_position_geolabels_b2020_split_dt

annotate_oslo_nor_map_bxxxx_split_dt()

Format

long

Location code.

lat

Location name.

order

The order that this line should be plotted in.

group

Needs to be used as 'group' aesthetic in ggplot2.

location_code

Location code (municipality code).

An object of class data.table (inherits from data.frame) with 4537 rows and 5 columns.

An object of class data.table (inherits from data.frame) with 15 rows and 4 columns.

An object of class data.table (inherits from data.frame) with 11 rows and 4 columns.

Details

Borders for 2024 and 2020 are provided.

Examples

# 2024 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + csmaps::annotate_oslo_nor_map_bxxxx_split_dt()
q <- q + geom_polygon(
  data = csmaps::nor_county_map_b2024_split_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

# 2024 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + csmaps::annotate_oslo_nor_map_bxxxx_split_dt()
q <- q + geom_polygon(
  data = csmaps::nor_county_map_b2024_split_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + ggrepel::geom_label_repel(
  data = csmaps::nor_county_position_geolabels_b2024_split_dt[repel==TRUE],
  mapping = aes(x = long, y = lat, label = location_code),
  size = 3,
  label.size = 0.1,
  label.r = grid::unit(0, "lines"),
  min.segment.length = 0
)
q <- q + geom_label(
  data = csmaps::nor_county_position_geolabels_b2024_split_dt[repel==FALSE],
  mapping = aes(x = long, y = lat, label = location_code),
  size = 3,
  label.size = 0.1,
  label.r = grid::unit(0, "lines")
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

# 2020 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + csmaps::annotate_oslo_nor_map_bxxxx_split_dt()
q <- q + geom_polygon(
  data = csmaps::nor_county_map_b2020_split_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

Maps of Norwegian municipalities in data.table format

Description

We conveniently package map datasets for Norwegian municipalities (taken from Geonorge) that can be used in ggplot2 without needing any geo libraries. This data is licensed under Creative Commons BY 4.0 (CC BY 4.0).

Usage

nor_municip_map_b2024_default_dt

nor_municip_map_b2020_default_dt

nor_municip_map_b2019_default_dt

nor_municip_position_geolabels_b2024_default_dt

nor_municip_position_geolabels_b2020_default_dt

nor_municip_position_geolabels_b2019_default_dt

Format

long

Location code.

lat

Location name.

order

The order that this line should be plotted in.

group

Needs to be used as 'group' aesthetic in ggplot2.

location_code

Location code (municipality code).

An object of class data.table (inherits from data.frame) with 30601 rows and 5 columns.

An object of class data.table (inherits from data.frame) with 31705 rows and 5 columns.

An object of class data.table (inherits from data.frame) with 356 rows and 3 columns.

An object of class data.table (inherits from data.frame) with 356 rows and 3 columns.

An object of class data.table (inherits from data.frame) with 422 rows and 3 columns.

Details

Borders for 2024, 2020, and 2019 are provided.

Examples

# 2024 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_municip_map_b2024_default_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.2
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

# 2020 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_municip_map_b2020_default_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.2
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

# 2019 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_municip_map_b2019_default_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.2
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

Maps of Norwegian municipalities in sf format

Description

This data is licensed under Creative Commons BY 4.0 (CC BY 4.0).

Usage

nor_municip_map_b2024_default_sf

nor_municip_map_b2020_default_sf

nor_municip_map_b2019_default_sf

Format

geometry

Multipolygon

location_code

Location code (municipality code).

An object of class sf (inherits from data.frame) with 356 rows and 2 columns.

An object of class sf (inherits from data.frame) with 422 rows and 2 columns.

Details

Borders for 2024, 2020, and 2019 are provided.


Maps of Norwegian municipalities with an insert for Oslo in data.table format

Description

We conveniently package map datasets for Norwegian municipalities (taken from Geonorge) that can be used in ggplot2 without needing any geo libraries. This data is licensed under Creative Commons BY 4.0 (CC BY 4.0).

Usage

nor_municip_map_b2024_insert_oslo_dt

nor_municip_map_b2020_insert_oslo_dt

nor_municip_map_b2019_insert_oslo_dt

nor_municip_position_geolabels_b2024_insert_oslo_dt

nor_municip_position_geolabels_b2020_insert_oslo_dt

nor_municip_position_geolabels_b2019_insert_oslo_dt

Format

long

Location code.

lat

Location name.

order

The order that this line should be plotted in.

group

Needs to be used as 'group' aesthetic in ggplot2.

location_code

Location code (county code).

An object of class data.table (inherits from data.frame) with 30659 rows and 5 columns.

An object of class data.table (inherits from data.frame) with 31763 rows and 5 columns.

An object of class data.table (inherits from data.frame) with 356 rows and 3 columns.

An object of class data.table (inherits from data.frame) with 356 rows and 3 columns.

An object of class data.table (inherits from data.frame) with 422 rows and 3 columns.

Details

Borders for 2024, 2020, and 2019 are provided.

Examples

# 2024 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_municip_map_b2024_insert_oslo_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.2
)
q <- q + annotate(
  "text",
  x = csmaps::nor_xxx_position_title_insert_oslo_b2024_insert_oslo_dt$long,
  y = csmaps::nor_xxx_position_title_insert_oslo_b2024_insert_oslo_dt$lat,
  label = "Oslo"
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

# 2020 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_municip_map_b2020_insert_oslo_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.2
)
q <- q + annotate(
  "text",
  x = csmaps::nor_xxx_position_title_insert_oslo_b2020_insert_oslo_dt$long,
  y = csmaps::nor_xxx_position_title_insert_oslo_b2020_insert_oslo_dt$lat,
  label = "Oslo"
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

# 2019 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_municip_map_b2019_insert_oslo_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.2
)
q <- q + annotate(
  "text",
  x = csmaps::nor_xxx_position_title_insert_oslo_b2019_insert_oslo_dt$long,
  y = csmaps::nor_xxx_position_title_insert_oslo_b2019_insert_oslo_dt$lat,
  label = "Oslo"
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

Split map of Norwegian municipalities in data.table format

Description

We conveniently package map datasets for Norwegian municipalities (taken from Geonorge) that can be used in ggplot2 without needing any geo libraries. This data is licensed under Creative Commons BY 4.0 (CC BY 4.0).

Usage

nor_municip_map_b2024_split_dt

nor_municip_map_b2020_split_dt

Format

long

Location code.

lat

Location name.

order

The order that this line should be plotted in.

group

Needs to be used as 'group' aesthetic in ggplot2.

location_code

Location code (municipality code).

An object of class data.table (inherits from data.frame) with 30601 rows and 5 columns.

Details

Borders for 2024 and 2020 are provided.

Examples

# 2024 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_municip_map_b2024_split_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.2
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

# 2020 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_municip_map_b2020_split_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.2
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

Position of a title for the Oslo insert

Description

Position of a title for the Oslo insert

Usage

nor_xxx_position_title_insert_oslo_b2024_insert_oslo_dt

nor_xxx_position_title_insert_oslo_b2020_insert_oslo_dt

nor_xxx_position_title_insert_oslo_b2019_insert_oslo_dt

nor_xxx_position_title_insert_oslo_b2017_insert_oslo_dt

Format

long

Location code.

lat

Location name.

An object of class data.table (inherits from data.frame) with 1 rows and 2 columns.

An object of class data.table (inherits from data.frame) with 1 rows and 2 columns.

An object of class data.table (inherits from data.frame) with 1 rows and 2 columns.

Examples

# 2020 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::nor_municip_map_b2020_insert_oslo_dt,
  mapping = aes(group = group),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + annotate(
  "text",
  x = csmaps::nor_xxx_position_title_insert_oslo_b2020_insert_oslo_dt$long,
  y = csmaps::nor_xxx_position_title_insert_oslo_b2020_insert_oslo_dt$lat,
  label = "Oslo"
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

Map of Oslo wards (bydeler) in data.table format

Description

We conveniently package map datasets for Oslo wards (bydeler) (taken from Oslo municipality) that can be used in ggplot2 without needing any geo libraries. This data is licensed under Creative Commons BY 4.0 (CC BY 4.0).

Usage

oslo_ward_map_b2024_default_dt

oslo_ward_map_b2020_default_dt

oslo_ward_position_geolabels_b2024_default_dt

oslo_ward_position_geolabels_b2020_default_dt

Format

long

Location code.

lat

Location name.

order

The order that this line should be plotted in.

group

Needs to be used as 'group' aesthetic in ggplot2.

location_code

Location code (ward code).

An object of class data.table (inherits from data.frame) with 1372 rows and 5 columns.

An object of class data.table (inherits from data.frame) with 15 rows and 3 columns.

An object of class data.table (inherits from data.frame) with 15 rows and 3 columns.

Details

Borders provided for 2024, 2020.

Examples

# 2024 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::oslo_ward_map_b2024_default_dt,
  mapping = aes(group = group, fill = location_code),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + geom_label(
  data = csmaps::oslo_ward_position_geolabels_b2024_default_dt,
  mapping = aes(label = location_code),
  color = "red"
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

# 2020 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
  data = csmaps::oslo_ward_map_b2020_default_dt,
  mapping = aes(group = group, fill = location_code),
  color = "black",
  fill = "white",
  linewidth = 0.4
)
q <- q + geom_label(
  data = csmaps::oslo_ward_position_geolabels_b2020_default_dt,
  mapping = aes(label = location_code),
  color = "red"
)
q <- q + theme_void()
q <- q + coord_quickmap()
q

Map of Oslo wards (bydeler) in sf format

Description

This data is licensed under Creative Commons BY 4.0 (CC BY 4.0).

Usage

oslo_ward_map_b2020_default_sf

oslo_ward_map_b2024_default_sf

Format

geometry

Multipolygon

location_code

Location code (municipality code).

An object of class sf (inherits from data.frame) with 15 rows and 2 columns.

Details

Borders provided for 2024, 2020.