-
Notifications
You must be signed in to change notification settings - Fork 1
/
0-config.R
148 lines (122 loc) · 5.93 KB
/
0-config.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#-------------------------------------
# ki longitudinal analysis manuscripts
# configure data directories
# source base functions
# load libraries
#-------------------------------------
kiPath <- c("/data/KI/R/x86_64-pc-linux-gnu-library/4.0/" , .libPaths())
.libPaths(kiPath)
library(tidyverse)
library(here)
library(ggplot2)
#library(dplyr)
library(gridExtra)
library(reshape2)
library(metafor)
library(data.table)
library(viridis)
library(ggthemes)
library(maps)
library(FField)
library(ggridges)
library(ggridges)
library(RColorBrewer)
library(gridExtra)
library(assertthat)
# library(haven)
#library(tidyselect)
# options(repos = c(CRAN = "http://cran.rstudio.com/",
# deltarho = "http://packages.deltarho.org"))
library(stringr)
library(mgcv)
library(grid)
library(lazyeval)
#library(rlang)
library(scales)
library(xtable)
# for parallel computing
# (will need to configure in each script)
#library(foreach)
#library(doParallel)
library(survey)
# install.packages("bit64")
library(bit64)
library(zoo)
# Define directories
res_dir = here::here("results/")
dhs_res_dir = here::here("results", "dhs")
data_dir = here::here("data")
metadata_dir = "U:/results/Metadata/"
true_data_dir = "/home/andrew.mertens/data/KI/UCB-SuperLearner/Manuscript analysis data/"
ghapdata_dir = "/data/KI/synthetic-data/"
project_functions_dir = here::here("0-project-functions/")
data_cleaning_dir = here::here("1-data-cleaning")
descriptive_outcomes_dir = here::here("2-descriptive-outcomes")
prep_tmle_analysis_dir = here::here("3-prep-tmle-analysis")
longbow_tmle_analysis_dir = here::here("4-longbow-tmle-analysis")
visualizations_dir = here::here("5-visualizations")
shiny_app_dir = here::here("6-shiny-app")
cc_shiny_app_dir = here::here("7-cc-shiny-app")
#Set cohort data file path
cohortdata_dir = paste0(ghapdata_dir, "cleaned individual study datasets/")
deriveddata_dir = paste0(ghapdata_dir, "covariate creation intermediate datasets/derived covariate datasets/")
# note: figures must be saved in same directory
# as shiny app in order to publish it
fig_dir = paste0(here::here(),"/figures/")
figdata_dir_stunting = paste0(here::here(),"/figures/stunting/figure-data/")
figdata_dir_wasting = paste0(here::here(),"/figures/wasting/figure-data/")
#################################
# Data Cleaning Scripts
included_studies_path = paste0(ghapdata_dir, "FINAL_only_included_studies.rds")
temp_clean_covariates_path = paste0(ghapdata_dir, "FINAL_temp_clean_covariates.rds")
clean_covariates_path = paste0(ghapdata_dir,"FINAL_clean_covariates.rds")
ki_manuscript_dataset_path = paste0(ghapdata_dir,"ki-synthetic-dataset.rds")
mortality_path = paste0(ghapdata_dir,"mortality.rds")
rf_stunting_data_path = paste0(ghapdata_dir, "rf_stunting_data.rds")
rf_wasting_data_path = paste0(ghapdata_dir, "rf_wasting_data.rds")
rf_underweight_path = paste0(ghapdata_dir, "rf_underweight_data.rds")
rf_co_occurrence_path = paste0(ghapdata_dir, "rf_co_occurrence_data.rds")
stunting_data_path = paste0(ghapdata_dir, "stunting_data.rds")
wasting_data_path = paste0(ghapdata_dir, "wasting_data.rds")
underweight_data_path = paste0(ghapdata_dir, "underweight_data.rds")
co_occurrence_data_path = paste0(ghapdata_dir, "co_occurrence_data.rds")
clean_DHS_haz_path = paste0(data_dir, "clean-DHS-haz.rds")
clean_DHS_waz_path = paste0(data_dir, "clean-DHS-waz.rds")
clean_DHS_whz_path = paste0(data_dir, "clean-DHS-whz.rds")
dhs_quantiles_path = paste0(dhs_res_dir, "/dhs_quantiles.rds")
seasonality_data_path = paste0(ghapdata_dir,"seasonality_data.rds")
HBDGki_CONSORT_inclusion_Ns_path = paste0(res_dir, "HBGDki_CONSORT_inclusion_Ns.rds")
metadata_GHAP_metadata_wasting_path = paste0(metadata_dir, "GHAP_metadata_wasting.RDS")
results_GHAP_metadata_wasting_path = paste0(res_dir, "GHAP_metadata_wasting.RDS")
metadata_GHAP_metadata_stunting_path = paste0(metadata_dir, "GHAP_metadata_stunting.RDS")
results_GHAP_metadata_stunting_path = paste0(res_dir, "GHAP_metadata_stunting.RDS")
metadata_GHAP_metadata_stunting_xlsx_path = paste0(metadata_dir, "GHAP_metadata_stunting.xlsx")
icc_res_path = paste0(res_dir,"icc_res.rds")
test_data_path = "C:/Users/andre/Documents/HBGDki/ki-longitudinal-manuscripts/data/simulated test data/testdata.rds"
asset_PCA_allstudies_path = paste0(project_functions_dir, "1_assetPCA-allstudies.R")
##################################
# Source base functions
source(paste0(project_functions_dir, "/0_clean_study_data_functions.R"))
source(paste0(project_functions_dir, "/0_descriptive_epi_shared_functions.R"))
source(paste0(project_functions_dir, "/0_descriptive_epi_stunt_functions.R"))
source(paste0(project_functions_dir, "/0_descriptive_epi_wast_functions.R"))
source(paste0(project_functions_dir, "/0_helper_sampling_weights.R"))
source(paste0(project_functions_dir, "/0_risk_factor_functions.R"))
# Set theme
source(paste0(here::here(), "/5-visualizations/0-plot-themes.R"))
theme_set(theme_ki())
cbbPalette <- c("#000000", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
scale_color_mert <- function(...){
ggplot2:::manual_scale(
'color',
values = setNames(c("#000000", "#E69F00", "#56B4E9", "#009E73"), c("Real", "QI", "BC", "FULL")),
...
)
}
scale_fill_mert <- function(...){
ggplot2:::manual_scale(
'color',
values = setNames(c("#000000", "#E69F00", "#56B4E9", "#009E73"), c("Real", "QI", "BC", "FULL")),
...
)
}