targets
targets
_targets.R
.
- Everything that exists in an object.
- Everything that happens is a function call.
John Chambers
_targets.R
.use_targets()
generates a template _targets.R
file.tar_edit()
to edit _targets.R
.tar_make()
#> ▶ dispatched target file
#> ● completed target file [0.098 seconds]
#> ▶ dispatched target data
#> ● completed target data [0.068 seconds]
#> ▶ dispatched target model
#> ● completed target model [0.002 seconds]
#> ▶ dispatched target plot
#> ● completed target plot [0.011 seconds]
#> ▶ ended pipeline [0.271 seconds]
\[ \begin{aligned} \theta^{\text{sim}} &\sim p(\theta) \qquad &&\text{1. Draw parameters from the prior.} \\ y^{\text{sim}} &\sim p(y | \theta^{\text{sim}}) \qquad &&\text{2. Draw data given parameters.} \\ \theta^{(1)}, \ldots, \theta^{(M)} &\sim p(\theta | y^{\text{sim}}) \qquad &&\text{3. Draw HMC samples from the posterior} \\ \end{aligned} \]
\[ p(\theta) = \int \int p(\theta | y^{\text{sim}}) p(y^{\text{sim}} | \theta^{\text{sim}}) p(\theta^{\text{sim}}) d \theta^{\text{sim}} d y^{\text{sim}} \]
run_simulation()
depends on get_sbc_ranks()
, another user-defined function._targets.R
._targets.R
.crew
and mirai
._targets.R
._targets.R
.run_simulation()
).tar_outdated()
#> [1] "ranks_batch_compound_symmetry"
#> [2] "ranks_moving_average"
#> [3] "ranks_diagonal"
#> [4] "results_diagonal"
#> [5] "prior_diagonal"
#> [6] "ranks_batch_autoregressive"
#> [7] "results_moving_average"
#> [8] "prior_unstructured"
#> [9] "prior_compound_symmetry"
#> [10] "results_subgroup"
#> [11] "prior_autoregressive_moving_average"
#> [12] "results_compound_symmetry"
#> [13] "results_autoregressive_moving_average"
#> [14] "ranks_subgroup"
#> [15] "ranks_compound_symmetry"
#> [16] "prior_autoregressive"
#> [17] "prior_moving_average"
#> [18] "ranks_batch_diagonal"
#> [19] "ranks_batch_subgroup"
#> [20] "ranks_autoregressive"
#> [21] "ranks_batch_moving_average"
#> [22] "ranks_batch_autoregressive_moving_average"
#> [23] "results_unstructured"
#> [24] "ranks_batch_unstructured"
#> [25] "results_autoregressive"
#> [26] "prior_subgroup"
#> [27] "ranks_autoregressive_moving_average"
#> [28] "ranks_unstructured"
tar_make()
#> ...
#> ▶ dispatched target prior_subgroup
#> ▶ dispatched target prior_moving_average
#> ▶ dispatched target prior_diagonal
#> ...
#> ▶ dispatched branch ranks_moving_average_0622a4a0a1459592
#> ▶ dispatched branch ranks_autoregressive_average_4d6e2b84dfce31bc
#> ● completed branch ranks_unstructured_391a8253aae8fc3e [1.321 hours]
#> ● completed branch ranks_unstructured_6fc2a563c4c2fecc [1.265 hours]
#> ...
tar_read(ranks_unstructured)
#> # A tibble: 1,000 × 19
#> b_groupgroup_1 b_groupgroup_2 b_groupgroup_3 b_timetime_2
#> <dbl> <dbl> <dbl> <dbl>
#> 1 4104 2573 3593 8346
#> 2 11074 10962 10986 2911
#> 3 9407 10515 9904 2703
#> 4 6878 28 728 9672
#> 5 3467 3365 3510 11599
#> 6 6156 7975 6034 9547
#> 7 6971 5843 1357 11736
#> 8 1289 762 3830 10178
#> 9 8738 6655 10501 2387
#> 10 7985 7380 6802 6918
#> # ℹ 990 more rows
#> # ℹ 15 more variables...
© Eli Lilly and Company