-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRunPfc.R
72 lines (57 loc) · 1.43 KB
/
RunPfc.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
# packages -----
library(data.table)
library(dtplyr)
library(dplyr, warn.conflicts = FALSE)
library(ggplot2)
library(Hmisc)
library(kableExtra)
library(stringr)
library(scales)
library(tidyr)
library(withr)
library(parallel)
library(RSQLite)
library(DBI)
library(rmarkdown)
library(cmprsk)
library(survminer)
library(here)
# Set up -----
country<-"Spain"
# one of
## Spain
## Netherlands
## NetherlandsPerfectPfc
## Japan
## JapanInjectOnly
## JapanReducedPfc
## Brazil
## Colombia
## France
## Mexico
## UnitedKingdom
## GenericCountry
# shiny::runApp(here("RShiny"))
#switch to true if using risk profiles
use.risk.profiles<-FALSE
# run model ---
start<-Sys.time()
run.in.parallel<-TRUE
source("RMicrosim/extras/CodeToRun.R")
# generate report -----
# create folder to save report if it doesn´t already exist
if (!file.exists( here("report",country))){
dir.create( here("report",country), recursive = TRUE)}
# write csv with all the inputs
write.csv(t(data.frame(user_inputs)),
here("report",country,
paste0("report ",country," ", format(Sys.Date(),"%Y_%m_%d"), " ", n_microsimulation, "_sims.csv" )
))
# write report
render(here("report","report.Rmd"),
params = list(
country = country,
on.ARC = FALSE),
output_dir = here("report",country),
output_file=paste0("report ",country," ", format(Sys.Date(),"%Y_%m_%d"), " ", n_microsimulation, "_sims" ))
Sys.time()-start