suistats
-package
The goal of suistats is to use of data from the Federal Statistical Office of Switzerland easier within R. But that is a long-term goal. We start with using their Swiss map. Find examples below.
Map data, municipality info and ZIP-code mapping data are all retrieved from https://www.bfs.admin.ch.
Installation
You can install it with:
devtools::install_github("tinino/suistats")
Find the repo here: https://github.com/tinino/suistats
Example
Plot municipalities:
library(ggplot2)
library(suistats)
ggplot(data = make_layer_data(agg_level = "GDNR"),
mapping = aes(x = long, y = lat, group = group)) +
geom_polygon() +
geom_polygon(data = ch_shape_lake, fill = "deepskyblue") +
geom_path(color = "white") +
coord_equal()
#> Loading required package: sp
#> Regions defined for each Polygons
Plot districts:
ggplot(data = make_layer_data(agg_level = "BZNR"),
mapping = aes(x = long, y = lat, group = group)) +
geom_polygon() +
geom_polygon(data = ch_shape_lake, fill = "deepskyblue") +
geom_path(color = "white") +
coord_equal()
#> Regions defined for each Polygons
Leave a Comment