Skip to content

Instantly share code, notes, and snippets.

@vankesteren
Last active November 22, 2021 12:51
Show Gist options
  • Select an option

  • Save vankesteren/63eea9ea2f3c45f5c17cb7726eb3e54c to your computer and use it in GitHub Desktop.

Select an option

Save vankesteren/63eea9ea2f3c45f5c17cb7726eb3e54c to your computer and use it in GitHub Desktop.
Where do people living in Utrecht look for a house?
# load packages
library(tidyverse)
library(sf)
# read data
flow <- read_csv("https://data.mendeley.com/public-files/datasets/rtn8t47t6j/files/7f85a66d-a80d-4e3d-ada8-694a9c6e0a28/file_downloaded")
gem <- st_read("WFS:https://geodata.nationaalgeoregister.nl/wijkenbuurten2018/wfs?&request=GetCapabilities&service=WFS",
"wijkenbuurten2018:gemeenten2018")
# clean gemeente dataset
gem_s <-
gem %>%
filter(aantal_inwoners > 0) %>%
select(gemeentecode, gemeentenaam, bevolkingsdichtheid_inwoners_per_km2, geom)
# filter outgoing flow from Utrecht
utr <- left_join(gem_s, flow %>% filter(user_mun_name == "Utrecht"), by = c("gemeentecode" = "object_mun_code"))
# visualise
utr %>%
ggplot(aes(fill = flow_hits)) +
geom_sf(colour = "white") +
scale_fill_viridis_c(trans = "log1p", guide = "none") +
theme_minimal() +
labs(title = "Where do people living in Utrecht look for a house?",
subtitle = "As measured by hits on funda.nl in 2018H1")
# save
ggsave("utr_hits.png", width = 7, height = 8, bg = "white")
@vankesteren
Copy link
Author

utr_hits

@vankesteren
Copy link
Author

Data from Steegmans, Joep; de Bruin, Jonathan (2021), “Online housing search dataset: Information flows of real estate platform users”, Mendeley Data, V1, doi: 10.17632/rtn8t47t6j.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment