-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.R
49 lines (37 loc) · 1.22 KB
/
index.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
#!/SYSTEM/R/3.5.1/bin/Rscript
# `simrc` should contain `module load gcc/5.3.0` and `module load R/3.5.1`
if (length(intersect(dir(), 'result')) == 0) { system('mkdir result') }
options(bitmapType='cairo')
# libraries ----
if (Sys.info()['sysname'] == 'Linux') { .libPaths('./lib') }
library(dplyr)
library(tidyr)
library(purrr)
library(readr)
library(knitr)
library(deSolve)
library(wnl)
library(NonCompart)
# Arguments
input_deck <- 'number = PK02 ;
'
arguments <- commandArgs(trailingOnly = TRUE)
if (length(arguments) == 0) { arguments <- c("-inp", input_deck, "-file", "TBD.csv") }
table_args <- matrix(arguments, ncol = 2, byrow = TRUE) %>%
as_tibble() %>%
mutate(V1 = sub('-', '', V1)) %>%
spread(V1, V2) %>%
print()
pk_number <- read_delim(table_args$inp, delim = '=', col_names = c('param', 'value')) %>%
mutate_all(funs(trimws)) %>%
mutate(value = sub(' ;', '', value)) %>%
print()
# Make a report ----
knitr::knit2html(input = sprintf("%s-report.Rmd", pk_number$value),
output = "result/report.html",
options = c("toc", "mathjax"),
force_v1 = TRUE,
encoding = 'UTF-8')
system('cp -r figure result')
print(capabilities())
print(sessionInfo())