From 1f55608ebfca67ee68cba830651a56596d469f02 Mon Sep 17 00:00:00 2001 From: nwickel Date: Fri, 15 Sep 2023 16:27:08 +0200 Subject: [PATCH] Got information for holidays and school vacations; put it into CSVs --- code/schulferien_json-to-dataframe.R | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 code/schulferien_json-to-dataframe.R diff --git a/code/schulferien_json-to-dataframe.R b/code/schulferien_json-to-dataframe.R new file mode 100644 index 0000000..4464845 --- /dev/null +++ b/code/schulferien_json-to-dataframe.R @@ -0,0 +1,18 @@ +# setwd("C:/Users/nwickelmaier/Nextcloud/Documents/MDS/2023ss/60100_master_thesis/data/metadata") + +# https://ferien-api.de/#holidaysPerStateAndYear +# Data extracted (on Linux) via: +# curl https://ferien-api.de/api/v1/holidays/NI > schulferien_NI.json + +library(jsonlite) + +dat <- read_json("schulferien_NI.json", simplify = TRUE) +dat$slug <- NULL +dat$stateCode <- NULL + +dat$name <- paste0(gsub("^(.*).niedersachsen.*", "\\1", dat$name), + gsub("^.*niedersachsen [0-9]{4}(.*)", "\\1", + dat$name)) + +write.table(dat, "schulferien_2019-2025_NI.csv", sep = ";", row.names = FALSE) +