Disclaimer: This is not a minimal example.
This is an example of a {targets} workflow that runs Bayesian analyses and rendering a manuscript using Quarto.
R/functions.R contains some utility functions that are often used in my workflow.
ms/manuscript.qmd contains examples of cross-referencing and parameterized texts.
Option 1: running on local
-
Quarto: An open-source scientific and technical publishing system built on Pandoc
-
cmdstan: The shell interface to Stan
-
TinyTeX: A lightweight, cross-platform, portable, and easy-to-maintain LaTeX distribution based on TeX Live
-
renv: A dependency management toolkit for R
Option 2: running on an Apptainer/Singularity container (Linux only)
- Apptainer/Singularity: the container system for secure high performance computing
To run analysis:
# To install R packages for the first run
# Rscript -e "renv::restore()"
run Rscript
To generate the manuscript:
make
Currently, it is easier to separate Quarto rendering from a {targets} workflow.
See Quarto targets - indicate code chunk that causes error #99
To build Apptainer containers:
sudo apptainer build radian.sif radian.defapptainer exec --env RENV_PATHS_CACHE=/home/${USER}/renv \
--env RENV_PATHS_PREFIX_AUTO=TRUE \
radian.sif Rscript -e "renv::restore()"To run analysis:
apptainer exec --env RENV_PATHS_CACHE=/home/${USER}/renv \
--env RENV_PATHS_PREFIX_AUTO=TRUE \
radian.sif Rscript run.R.Renviron is ignored in git.
It is useful to add the following information to .Renviron to use {renv} caches on Linux.
#renv settings
RENV_PATHS_PREFIX_AUTO=TRUE
RENV_PATHS_CACHE=/home/${USER}/renv
You can also generate Rd files under man/ by running roxygen2::roxygenise().