Folder Structure

By using an R package folder structure and the associated development tools, we are able to achieve:

  • Consistency
  • Automation
  • Reproducibility
  • Compliance

Below are the minimal sufficient folders and files leveraging the R package folder structure.

  • *.Rproj: RStudio project file for opening the project.
  • DESCRIPTION: Metadata for a package including authors, license, dependencies, etc.
  • vignettes/: Analysis scripts using R Markdown.
  • R/: Project-specific R functions.
  • man/: Manual of project-specific R functions.

There are additional folders and files required in this demo for an analysis project.

People may use different folder names as it is not a standard R package folder. These folders and files often need to be added in .Rbuildignore to pass automated checking.

  • vignettes/data-adam/: ADaM datasets in .sas7bdat format.
    • One may also put it in inst/extdata/ following R package convention
    • In reality, we suggest to have real data saved outside of this project (e.g., in a database)
  • vignettes/tlf/: TLF outputs
  • renv.lock and renv/: R package management using the renv package (introduction).
  • _pkgdown.yml: pkgdown configuration file
  • .Rprofile: Project startup file to setup running environment including R version, package repository, folder paths, etc.
    • We further use inst/startup.R and R/zzz.R to ensure the startup file is executed both when running devtools::load_all() and running regular build & reload.