-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_cohort_data.R
37 lines (26 loc) · 1.02 KB
/
create_cohort_data.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Kansenkaart data preparation pipeline
#
# Full cohort creation script
#
# (c) ODISSEI Social Data Science team 2023
# input the desired config file here:
# yml: main, students, high_school, elementary_school, classroom,
# perinatal
cohort <- "main"
cfg_file <- paste0("config/", cohort, ".yml")
#### CONFIGURATION ####
# load the configuration
cfg <- config::get("data_preparation", file = cfg_file)
loc <- config::get("file_locations", file = cfg_file)
# create the scratch folder
if (!dir.exists(loc$scratch_folder)) dir.create(loc$scratch_folder)
#### RUN ####
# select cohort
source(list.files(file.path("src", cfg$cohort_name), "01_", full.names = TRUE))
# add predictors
source(list.files(file.path("src", cfg$cohort_name), "02_", full.names = TRUE))
# add outcomes
source(list.files(file.path("src", cfg$cohort_name), "03_", full.names = TRUE))
# post-process
source(list.files(file.path("src", cfg$cohort_name), "04_", full.names = TRUE))
# the pre-processed cohort data file is now available in the scratch folder!