Skip to content

DfE-DAU/dau-R-template

Repository files navigation

dauRtemplate

The RStudio projects of your colleagues all have a different structure? It is difficult to navigate and understand others' projects? Or even your own project from a few months/years ago? Therefore, it is useful if you all agree on a standard folder structure for your analysis. Templates can help to enforce this.

This package provides one standard project folder structure template for R projects geared towards DAU analysis use cases. Whenever you start a new project in RStudio, this package provides the standard folder structure directly in your code editor. Also, it can help you improving reproducibility by using git and renv.

(Folder structure of the template)


Installation

remotes::install_github("DfE-DAU/dau-R-template")

Usage

To create a new project with the folder structure shown below, follow these steps:

  1. Install the package

  2. Restart RStudio

  3. When creating a new RStudio project with the "New directory" option, choose "DAU project template"

    (RStudio Project Wizard showing the "DAU project template" option)


  1. During initialization you can select if you want to include a package structure (check "Include folders and files required to build a R package (recommended).")
  2. You can select if you want to generate a GitHub suitable .gitignore file (check "Create a .gitignore file for GitHub")
  3. Once you've created the project, you will be provided with the instructions how to create a git repository for your project and connect to GitHub/Azure DevOps.

Template overview

A new project contains the following folder structure:

|-- 01_Data
|   |-- 01_Raw
|   `-- 02_Clean
|-- R
|   |-- load_data.R
|   |-- helpers.R
|   |-- src
|-- tests
|   |-- testthat.R
|   |-- testthat
|   |   |-- test-load_data.R
|   |   |-- test-helpers.R
|-- 02_Analysis
|   |-- analysis.Rmd
|   |-- analysis.qmd
|-- 03_Documentation
|   |-- 01_text
|   `-- 02_figures
|-- 04_Outputs
|   |-- 01_results              
|   |-- 02_figures              
|   `-- 03_tables    
|-- 05_Misc
|   |-- 01_public              
|   |-- 02_priv
|-- README.md
|-- proj_name.Rproj
|-- .gitignore
|-- .Rprofile
|-- renv                        

Planned features

  • Collaboration with DAU team to agree on folder and file structure.
  • Further testing and documentation of the package.
  • More support for a package folder structure.
  • Integration with QA (automated QA document).
  • Support for Shiny apps.

Acknowledgements

This repository is very much built on the repository analysistemplates by jonas-hag (Jonas Hagenberg).

They should take all the credit for producing the core infrastructure of this package.

About

A template folder structure for DAU R projects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages