Skip to contents

R Analysis Packages are an extension of the standard R package layout designed to support publishing a collection of R notebooks used for data analysis as static html, typically using GitHub Pages.

R Notebooks include a YAML header and R Markdown body. The Analysis Package Layout follows the convention that the first non-blank line in the body of an R notebook serves as a brief description of the work. rdev includes an “Analysis Notebook” RStudio R Markdown template (File > New File > Rmarkdown > From Template) and a README.Rmd template optionally installed with use_analysis_package() that dynamically builds a list of notebooks and descriptions when devtools:build_readme() is run.

Starting in version 1.8.0, rdev also supports publishing Analysis Notebooks using Quarto as an alternative to the original use_analysis_package().

rdev versions 1.10.2 and newer also support use of Quarto Documents (.qmd) for Analysis Notebooks, although RStudio currently doesn’t support .qmd files as document templates.

The table below documents the complete R Analysis Package layout:

  • Path: Path to the file or directory relative to the package root
  • R: Included in the R package definition
  • g: Stored in git
  • Function: The function of the file or directory
Path R g Function
.Rbuildignore x Files excluded from the package, sorted using sort_rbuildignore()
.RData Saved workspace - not used
.Rhistory R command history
.Rprofile x Used by renv and to attach development tools and set project options
.Rproj.user RStudio local project files
.git git version control
.github x GitHub templates and workflows
.gitignore x git exclusions based on GitHub R. Generated files outside of docs (used by GitHub Pages) are excluded.
.lintr x lintr configuration as described in the Style Guide, vignette("style-guide")
.nojekyll x Disable Jekyll processing on GitHub Pages
.quarto Used by Quarto
DESCRIPTION x x Package metadata. Use “Suggests” for development tools, per renv
LICENSE x x Generated with usethis::use_mit_license() x See above, used by pkgdown and Quarto
NAMESPACE x x Automatically generated with roxygen2 x x Release notes, used by get_release(), pkgdown and Quarto
R x x All project functions go here, with roxygen2 comments
README.Rmd x Generated with usethis::use_readme_md() or rdev template x x Generated with devtools::build_readme() x x To-do list, inspired by renv’s historical
_freeze x Used by the Quarto freeze option
_pkgdown.yml x pkgdown metadata, stored in the project root to make it more discoverable (not used with Quarto)
_quarto.yml x x Quarto configuration file
analysis x x Exploratory data analysis in R Notebooks, R Presentations, and Quarto documents. Include functions from the R directory using library(), not source().
analysis/_metadata.yml x x Quarto directory configuration file
analysis/assets x x External assets (images, other files) included in R Notebooks
analysis/data x x Used to store small data sets used for analysis and exported data as csv files
analysis/import Used for local storage of large data sets
analysis/rendered Manually rendered versions of analysis/ files to be included in docs/, like .Rpres files
changelog.qmd x x Quarto front-end to
demos x Not used, as recommended by R Packages
docs x Used by build_analysis_site() and build_quarto_site() to render the R Package and Notebooks for GitHub Pages
exec x Command line executable scripts - not used
index.qmd x x Quarto home page, using the listing page format
inst x x Installed files: templates and WORDLIST
inst/bin x x Used for shell scripts that support development, like setup-r
inst/rmarkdown/templates x x R Markdown Templates
man x x Automatically generated with roxygen2
package.Rproj x Use the same name for the package, .Rproj, directory, and GitHub repository
pkgdown x Store all pkgdown files here (not used with Quarto)
po x x Used for Internationalization if needed
renv x Used by renv
renv.lock x renv lockfile
tests x x Tests using testthat and spelling
tools x Auxiliary files needed for building packages - not used
vignettes x x Package vignettes and articles, written in R Markdown