Description Usage Arguments Value Examples
Creates dynamic chloropleth maps of danish parishes
1 2 |
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 |
An interactive Leaflet map
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.