parishDK: Creates dynamic chloropleth maps of danish parishes

Description Usage Arguments Value Examples

Description

Creates dynamic chloropleth maps of danish parishes

Usage

1
2
parishDK(value = NULL, id = NULL, subplot = NULL, data = NULL,
  map = FALSE, legend = FALSE, pal = "YlOrRd", logcol = F)

Arguments

value

is the name of the column in the data where the values are stored

id

is the name of the column in the data where the ids are stored

subplot

is a string of ids you want to keep - excludes all others

data

is the data frame that contains the data to map

map

is a TRUE / FALSE of wether a real map should be plotted underneath

Value

An interactive Leaflet map

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(leafletDK)

km1 <- readr::read_csv2("http://api.statbank.dk/v1/data/KM1/CSV?SOGN=*&FKMED=*")
km1 <- tidyr::spread(km1, FKMED, INDHOLD)
km1$SOGN <- stringr::str_trim(stringr::str_replace_all(km1$SOGN, "(\\d+)|([-])", ""))
km1 <- dplyr::group_by(km1, SOGN)
km1 <- dplyr::summarise(km1,
                        medlem = sum(`Medlem af Folkekirken`, na.rm = T),
                        ikke_medlem = sum(`Ikke medlem af Folkekirken`, na.rm = T))
km1 <- dplyr::mutate(km1, pct = medlem/(ikke_medlem + medlem), pct = round(pct*100,2))

parishDK("pct", "SOGN", data = km1)

56north/leafletDK documentation built on May 5, 2019, 11:27 a.m.