-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_targets.R
48 lines (39 loc) · 1001 Bytes
/
_targets.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
library(targets)
library(tarchetypes)
source("R/functions.R")
options(tidyverse.quiet = TRUE)
options(clustermq.scheduler = "multicore")
#install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
tar_option_set(packages = c("cmdstanr", "posterior", "bayesplot", "tidyverse", "stringr","knitr"))
list(
tar_target(
raw_data_file,
"data/postfire.csv",
format = "file"
),
tar_target(
raw_data,
read_csv(raw_data_file)[-1,]
),
tar_target(
data,
raw_data %>%
clean_data()
),
tar_target(
group_data,
data %>%
group_data_function()
),
tar_target(
stan_data,
stan_data_function(data,group_data)
),
tar_target(model,
cmdstan_model('firemodel_predict.stan',
compile = TRUE)),
tar_target(model_fit, fit_model(model, stan_data)),
tar_target(posterior_summary,
summarize_posteriors(model_fit,data)),
tar_render(report, "index.Rmd")
)