Clean up after manual sampling. This is essentially a safe
version of deleting the directory (e.g, unlink(path, recursive = TRUE)
) which checks that the directory really was used for
sampling and that it does not contain anything else unexpected.
Arguments
- path
The path used in the call to monty_sample_manual_prepare
Examples
model <- monty_example("banana")
sampler <- monty_sampler_random_walk(vcv = diag(2) * 0.05)
path <- tempfile()
monty_sample_manual_prepare(model, sampler, 100, path)
monty_sample_manual_info(path)
#>
#> ── Manual monty sampling at /tmp/RtmpAteMlX/file16324481e725 ───────────────────
#> ℹ Created 2024-11-06 16:03:02
#> ℹ 100 steps x 1 chains
#> ✖ No chains complete
# Run the (single) chain
monty_sample_manual_run(1, path)
#> Sampling ■ | 1% ETA: 0s
#> ✔ Sampled 100 steps across 1 chain in 20ms
#>
monty_sample_manual_info(path)
#>
#> ── Manual monty sampling at /tmp/RtmpAteMlX/file16324481e725 ───────────────────
#> ℹ Created 2024-11-06 16:03:02
#> ℹ 100 steps x 1 chains
#> ✔ All chains complete
# Collect the results
monty_sample_manual_collect(path)
#>
#> ── <monty_samples: 2 parameters x 100 samples x 1 chain> ───────────────────────
#> ℹ Parameters: 'alpha' and 'beta'
#> ℹ Conversion to other types is possible:
#> → ✔ posterior::as_draws_array() [package loaded]
#> → ✔ posterior::as_draws_df() [package loaded]
#> → ✔ coda::as.mcmc.list() [package loaded]
#> ℹ See `?monty_sample()` and `vignette("samples")` for more information
# Clean up samples
monty_sample_manual_cleanup(path)