From 2c51829c578e410ae8df457afd34c1b72a2735c8 Mon Sep 17 00:00:00 2001 From: FlorianSchw Date: Wed, 18 Dec 2024 14:38:00 +0100 Subject: [PATCH] including the sub-folder directory commands for where the harmonised datasets will be stored --- scripts/GINI_P1.R | 4 +++- scripts/GINI_P2.R | 4 +++- scripts/KORA_S1_P1.R | 4 +++- scripts/KORA_S1_P2.R | 4 +++- scripts/KORA_S3_P1.R | 4 +++- scripts/KORA_S3_P2.R | 4 +++- scripts/LISA_P1.R | 4 +++- scripts/LISA_P2.R | 4 +++- 8 files changed, 24 insertions(+), 8 deletions(-) diff --git a/scripts/GINI_P1.R b/scripts/GINI_P1.R index 8694953..526bd93 100644 --- a/scripts/GINI_P1.R +++ b/scripts/GINI_P1.R @@ -104,8 +104,10 @@ fabR::bookdown_open(bookdown_path) #### Step 9: Extract and save harmonized data into a pre-set folder harmonized_dataset <- Rmonize::pooled_harmonized_dataset_create(harmonized_dossier) +ifelse(!dir.exists(file.path(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name)))),dir.create(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name))), FALSE) + readr::write_delim(x = harmonized_dataset, - file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_harmonized.csv")), + file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_", system_name, "/", dataset_name,"_harmonized.csv")), delim = ",", na = "") diff --git a/scripts/GINI_P2.R b/scripts/GINI_P2.R index 38f4f69..c98b40f 100644 --- a/scripts/GINI_P2.R +++ b/scripts/GINI_P2.R @@ -104,7 +104,9 @@ fabR::bookdown_open(bookdown_path) #### Step 9: Extract and save harmonized data into a pre-set folder harmonized_dataset <- Rmonize::pooled_harmonized_dataset_create(harmonized_dossier) +ifelse(!dir.exists(file.path(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name)))),dir.create(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name))), FALSE) + readr::write_delim(x = harmonized_dataset, - file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_harmonized.csv")), + file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_", system_name, "/", dataset_name,"_harmonized.csv")), delim = ",", na = "") \ No newline at end of file diff --git a/scripts/KORA_S1_P1.R b/scripts/KORA_S1_P1.R index a177c61..60f6f5f 100644 --- a/scripts/KORA_S1_P1.R +++ b/scripts/KORA_S1_P1.R @@ -104,8 +104,10 @@ fabR::bookdown_open(bookdown_path) #### Step 9: Extract and save harmonized data into a pre-set folder harmonized_dataset <- Rmonize::pooled_harmonized_dataset_create(harmonized_dossier) +ifelse(!dir.exists(file.path(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name)))),dir.create(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name))), FALSE) + readr::write_delim(x = harmonized_dataset, - file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_harmonized.csv")), + file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_", system_name, "/", dataset_name,"_harmonized.csv")), delim = ",", na = "") diff --git a/scripts/KORA_S1_P2.R b/scripts/KORA_S1_P2.R index 0553d07..119a1e5 100644 --- a/scripts/KORA_S1_P2.R +++ b/scripts/KORA_S1_P2.R @@ -104,7 +104,9 @@ fabR::bookdown_open(bookdown_path) #### Step 9: Extract and save harmonized data into a pre-set folder harmonized_dataset <- Rmonize::pooled_harmonized_dataset_create(harmonized_dossier) +ifelse(!dir.exists(file.path(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name)))),dir.create(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name))), FALSE) + readr::write_delim(x = harmonized_dataset, - file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_harmonized.csv")), + file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_", system_name, "/", dataset_name,"_harmonized.csv")), delim = ",", na = "") \ No newline at end of file diff --git a/scripts/KORA_S3_P1.R b/scripts/KORA_S3_P1.R index e557d0a..908aa3b 100644 --- a/scripts/KORA_S3_P1.R +++ b/scripts/KORA_S3_P1.R @@ -104,7 +104,9 @@ fabR::bookdown_open(bookdown_path) #### Step 9: Extract and save harmonized data into a pre-set folder harmonized_dataset <- Rmonize::pooled_harmonized_dataset_create(harmonized_dossier) +ifelse(!dir.exists(file.path(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name)))),dir.create(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name))), FALSE) + readr::write_delim(x = harmonized_dataset, - file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_harmonized.csv")), + file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_", system_name, "/", dataset_name,"_harmonized.csv")), delim = ",", na = "") diff --git a/scripts/KORA_S3_P2.R b/scripts/KORA_S3_P2.R index be7c610..b8ef208 100644 --- a/scripts/KORA_S3_P2.R +++ b/scripts/KORA_S3_P2.R @@ -104,7 +104,9 @@ fabR::bookdown_open(bookdown_path) #### Step 9: Extract and save harmonized data into a pre-set folder harmonized_dataset <- Rmonize::pooled_harmonized_dataset_create(harmonized_dossier) +ifelse(!dir.exists(file.path(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name)))),dir.create(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name))), FALSE) + readr::write_delim(x = harmonized_dataset, - file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_harmonized.csv")), + file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_", system_name, "/", dataset_name,"_harmonized.csv")), delim = ",", na = "") \ No newline at end of file diff --git a/scripts/LISA_P1.R b/scripts/LISA_P1.R index fdc6766..812ed08 100644 --- a/scripts/LISA_P1.R +++ b/scripts/LISA_P1.R @@ -104,8 +104,10 @@ fabR::bookdown_open(bookdown_path) #### Step 9: Extract and save harmonized data into a pre-set folder harmonized_dataset <- Rmonize::pooled_harmonized_dataset_create(harmonized_dossier) +ifelse(!dir.exists(file.path(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name)))),dir.create(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name))), FALSE) + readr::write_delim(x = harmonized_dataset, - file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_harmonized.csv")), + file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_", system_name, "/", dataset_name,"_harmonized.csv")), delim = ",", na = "") diff --git a/scripts/LISA_P2.R b/scripts/LISA_P2.R index af0f123..d9c13e5 100644 --- a/scripts/LISA_P2.R +++ b/scripts/LISA_P2.R @@ -104,8 +104,10 @@ fabR::bookdown_open(bookdown_path) #### Step 9: Extract and save harmonized data into a pre-set folder harmonized_dataset <- Rmonize::pooled_harmonized_dataset_create(harmonized_dossier) +ifelse(!dir.exists(file.path(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name)))),dir.create(here::here("output/harmonised_dataset/", paste0(dataset_name, "_", system_name))), FALSE) + readr::write_delim(x = harmonized_dataset, - file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_harmonized.csv")), + file = here::here(paste0("output/harmonised_dataset/", dataset_name, "_", system_name, "/", dataset_name,"_harmonized.csv")), delim = ",", na = "")