title: r paste0("How many streets and squares are dedicated to women in ", stringr::str_to_title(params$city), "?")

knitr::opts_chunk$set(echo = FALSE, message = FALSE)

library("genderedstreetnames")

These are all the streets of r stringr::str_to_title(params$city).

city_roads <- readRDS(file = params$city_roads_path)
city_boundary <- get_city_boundaries(city = params$city, country = params$country, cache = TRUE)

tmap::tm_shape(city_boundary) + 
  tmap::tm_polygons() +
  tmap::tm_shape(city_roads) +
  tmap::tm_lines()

How many of them are dedicated to women?

tmap::tmap_mode(mode = "plot")

city_map <- tmap::tm_shape(city_boundary) + 
  tmap::tm_polygons() +
  tmap::tm_shape(city_roads) +
  tmap::tm_lines(col = "Gender", palette = "Set1", textNA = "other")

city_map

Here you can have a closer look with an interactive version of the map:

tmap::tmap_mode("view")

tmap::tm_shape(city_boundary) + 
  tmap::tm_polygons(col = "lightblue", alpha = 0.2, popup.vars = FALSE) +
  tmap::tm_shape(city_roads) +
  tmap::tm_lines(col = "Gender",
                 lwd = 2,
                 palette = "Set1",
                 textNA = "other",
                 id = "name",
                 popup.vars = c("Gender", "Description"))
city_roads %>%
  dplyr::arrange(Gender) %>% 
  sf::st_set_geometry(NULL) %>% 
  dplyr::select(name, Gender, Description) %>% 
  dplyr::distinct(name, .keep_all = TRUE) %>% 
  DT::datatable(rownames = FALSE)


giocomai/genderedstreetnames documentation built on June 21, 2020, 8:31 p.m.