-
Notifications
You must be signed in to change notification settings - Fork 0
/
_setup.R
77 lines (66 loc) · 1.49 KB
/
_setup.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
# Replication controls
#
# To replicate figures for chapters 13 and 14 execute rep/strategy_replication.Rmd
# This analysis is slow (multiple hours for 13, multiple days for 14)
# The replication file has switches to allow figure replication only or
# complete simulation replication
# All other tables and figures are replicated on the fly within chapters
# Note: Chapter 16 loo and p value analyses are slow
# To replicate all these analyses set run to TRUE
run <- FALSE
# Packages
# Check if BiocManager is installed
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
# Check and install Rgraphviz
if (!requireNamespace("Rgraphviz", quietly = TRUE)) {
BiocManager::install("Rgraphviz")
}
# Check and install RBGL
if (!requireNamespace("RBGL", quietly = TRUE)) {
BiocManager::install("RBGL")
}
# Load packages, and install from CRAN when not already installed:
library("pacman")
pacman::p_load(
DT,
ggdag,
dagitty,
ggtext,
bookdown,
CausalQueries,
cowplot,
DeclareDesign,
GGally,
ggh4x,
ggstance,
gtools,
igraph,
latex2exp,
partitions,
plotrix,
pcalg,
rstan,
kableExtra,
knitr,
reshape2,
dagitty,
RBGL,
Rgraphviz,
rstan,
stargazer,#,
haven,
magrittr,
labelled,
repr,
sjmisc,
tidyverse
)
# Functions
source("helpers/_tools.R")
# Package options:
options(mc.cores = parallel::detectCores())
rstan_options(auto_write = TRUE)
knitr::opts_chunk$set(fig.align = "center")
options(knitr.kable.NA = '')