This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Unnest fields from a JSON/JSONB column in a PostgreSQL database table | |
#' | |
#' @inheritParams dbplyr:::select.tbl_lazy | |
#' @param .json_col Unquoted name of the JSONB column | |
#' @param ... Expressions in the syntax `<new_column_name> = "<json_field_name>"` | |
#' | |
unnest_json <- function(.data, .json_col, ...) { | |
.json_col <- rlang::ensym(.json_col) | |
col_names <- rlang::enexprs(...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr2) | |
corona_platform_api <- function(endpoint, ...) { | |
request("https://www.corona-datenplattform.de/api/3/action") |> | |
req_url_path_append(endpoint) |> | |
req_url_query(...) |> | |
req_perform() |> | |
resp_body_json() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://jokergoo.github.io/2020/06/08/multiple-group-chord-diagram/ | |
library(circlize) | |
library(tidyverse) | |
choices <- tribble( | |
~A, ~B, ~C, ~D, ~E, ~F, | |
NA, 2, NA, 3, 1, NA, | |
NA, 1, 3, NA, NA, 2, | |
NA, 1, 2, NA, NA, 3, | |
NA, 2, NA, 3, 1, NA, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(osmdata) | |
library(sf) | |
# Define functions -------------------------------------------------------- | |
query_streets <- function(place) { | |
query <- getbb(place) |> | |
opq() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Untitled" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE) | |
library(tidyverse) | |
library(sf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(sf) | |
library(stars) | |
# Migrazensus dataset downloaded from: https://doi.org/10.7910/DVN/GPEV4P | |
migrazensus <- read_csv(here::here("migrazensus_v0.2.csv")) |> | |
mutate(wknr_2021 = as.double(wknr_2021)) | |
# Shape files downloaded from | |
# https://www.bundeswahlleiter.de/dam/jcr/67e3e9b8-dbca-4bc9-8977-ac792665bbce/btw17_geometrie_wahlkreise_vg250_shp.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(RSelenium) | |
selenium_driver <- rsDriver(browser = "firefox") | |
selenium_driver$client$navigate("https://impffrei.work/wp-sitemap-posts-job_listing-1.xml") # :facepalm: | |
Sys.sleep(12) | |
page_source <- selenium_driver$client$getPageSource() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(ggtext) | |
library(espnscrapeR) | |
# Custom theme function ---- | |
theme_538 <- function(..., base_size = 12) { | |
theme( | |
# plotting components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(httr) | |
library(fs) | |
library(here) | |
titles_url <- "https://resource-cms.springernature.com/springer-cms/rest/v1/content/17858272/data/v4" | |
dl_folder <- "downloads" | |
# Save Excel table to tmp folder |