-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.R
35 lines (29 loc) · 972 Bytes
/
main.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
# Argument parsing
library(optparse)
cli::cli_h1("Emprical example starting")
option_list <- list(
make_option("--modify", type = "logical", default = TRUE,
help = "Perform initial data modification or not"),
make_option("--test", type = "logical", default = TRUE,
help = "Perform statistical tests or not"),
make_option("--analyze", type = "logical", default = TRUE,
help = "Perform analysis or not")
)
opt_parser <- OptionParser(option_list = option_list)
opt <- parse_args(opt_parser)
if (opt$modify) {
cli::cli_h2("Data modification starting")
system("Rscript modify.R")
cli::cli_h2("Data modification done")
}
if (opt$test) {
cli::cli_h2("Statistical testing starting")
system("Rscript test-assumptions.R")
cli::cli_h2("Statistical tests done")
}
if (opt$analyze) {
cli::cli_h2("Analysis starting")
system("Rscript analyze.R")
cli::cli_h2("Analysis done")
}
cli::cli_h1("Emprical example done")