This repository is a template for a
docker-containerised,
{targets}-based,
{renv}-enabled
R workflow for general data analysis.
The project repository is structured as follows:
sc-policy-review
|-- .github/
|-- data/
|-- data-raw/
|-- outputs/
|-- R/
|-- reports
|-- renv
|-- renv.lock
|-- .Rprofile
|-- packages.R
|-- _targets.R
-
.githubcontains project testing and automated deployment of outputs workflows via continuous integration and continuous deployment (CI/CD) using Github Actions. -
data/contains intermediate and final data outputs produced by the workflow. -
data-raw/contains raw datasets, usually either downloaded from source or added manually, that are used in the project. -
outputs/contains compiled reports and figures produced by the workflow. -
R/contains functions developed/created specifically for use in this workflow. -
reports/contains literate code for R Markdown and/or Quarto reports rendered in the workflow. -
renv/containsrenvpackage specific files and directories used by the package for maintaining R package dependencies within the project. The directoryrenv/library, is a library that contains all packages currently used by the project. This directory, and all files and sub-directories within it, are all generated and managed by therenvpackage. Users should not change/edit these manually. -
renv.lockfile is therenvlockfile which records enough metadata about every package used in this project that it can be re-installed on a new machine. This file is generated by therenvpackage and should not be changed/edited manually. -
.Rprofilefile is a project R profile generated when initiatingrenvfor the first time. This file is run automatically every time R is run within this project, andrenvuses it to configure the R session to use therenvproject library. -
packages.Rfile lists out all R package dependencies required by the workflow. -
_targets.Rfile defines the steps in the workflow’s data ingest, data processing, data analysis, and reporting pipeline.
This project was built using R 4.5.1. This project uses the renv
framework to record R package dependencies and versions. Packages and
versions used are recorded in renv.lock and code used to manage
dependencies is in renv/ and other files in the root project
directory. On starting an R session in the working directory, run
renv::restore() to install R package dependencies.