-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.R
More file actions
55 lines (41 loc) · 2.15 KB
/
main.R
File metadata and controls
55 lines (41 loc) · 2.15 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# ============================================================================
# Complete analysis pipeline for the UK Biobank repeat accelerometry sub-study
# ============================================================================
# Clean workspace and load configuration
rm(list = ls())
source(here::here("config.R"))
# Create output directories
dir.create(here::here("output/tables"), recursive = TRUE)
dir.create(here::here("output/figures"), recursive = TRUE)
# ===========================================================================
# Stage 1: Dataset preparation
# ===========================================================================
message("========== Loading and processing main accelerometer data...")
source(here::here("R", "1-prep", "01_prepare_main_phenotypes.R"))
message("========== Loading and processing repeat accelerometer data...")
source(here::here("R", "1-prep", "02_prepare_repeat_phenotypes.R"))
message("========== Applying quality control and exclusion criteria...")
source(here::here("R", "1-prep", "03_apply_exclusions.R"))
message("========== Reshaping and merging main with repeat measurements...")
source(here::here("R", "1-prep", "04_merge_main_repeat.R"))
message("========== Assembling final analysis dataset...")
source(here::here("R", "1-prep", "05_prepare_complete_dataset.R"))
# ===========================================================================
# Stage 2: Reproducibility analysis
# ===========================================================================
message("========== Running reproducibility and descriptive analysis...")
rmarkdown::render(
here::here("R", "2-analysis", "01_reproducibility_analysis.Rmd"),
output_dir = here::here("output"),
quiet = TRUE
)
# ===========================================================================
# Stage 3: Epidemiological analysis
# ===========================================================================
message("========== Running epidemiological analysis...")
rmarkdown::render(
here::here("R", "2-analysis", "02_epidemiological_analysis.Rmd"),
output_dir = here::here("output"),
quiet = TRUE
)
message("========== Pipeline finished successfully!")