ropensci / jagstargets

Reproducible Bayesian data analysis pipelines with targets and JAGS
https://docs.ropensci.org/jagstargets
Other
10 stars 6 forks source link

"Duplicate" chunks in MCMC pipelines vignette #14

Closed dill closed 3 years ago

dill commented 3 years ago

Prework

Description

This is part of ropensci/software-review#425, please don't feel you need to respond to this until I have submitted my full review.

In vignette mcmc.Rmd there are a few places (here, here and here) where there are basically two copies of the code, one that is actually evaled and one that's there to render in the output doco. That's totally fine, but the unecho'd chunk might be improved with some comments explaining why there are two versions of this chunk, for those following along in their own .Rmd or using your vignette as a template (and when one might need to do this in our own docos).

wlandau commented 3 years ago

Sure, I added some comments in https://github.com/wlandau/jagstargets/commit/18eeb2db40a49e5031868dac8f145095bd6135a4. targets requires a _targets.R file to run the analysis, but tar_script() in a visible code chunk is awkward to read. Having 2 code chunks is the only way I have been able to find that lets us have both automation and readability.