ESR Reporting Template

Description

This repository contains templating for consistent themed ESR reports/documents using RMarkdown. Currently, knitting to a html document/report is supported.

Here's a peek at the rendered html report:

Report preview

Software dependencies

Assumptions

  • You have access to ESR's production network
  • Some coding experience (command line and R)

How to use

Clone this github repository on ESR's production network

Navigate to your project directory, for example

cd /home/leah/my_project_to_report/

Clone this repository

git clone https://github.com/ESR-NZ/ESR_reporting_template.git

Open the reporting template in an RStudio project

Navigate to RStudio hosted on ESR's production network at http://rstudio.esr.cri.nz:8787, use your regular ESR login credentials to login to RStudio

RStudio sign in

Create a new RStudio project (this template was created using R version 4.1.2, use this version of R if you'd like to fully reproduce this example template, but the code should be adaptable to other versions of R with some R coding knowledge)

Create project in RStudio

Open the reporting RMarkdown (RMD) file, this is the main file for the reporting template

Create project in RStudio

Restore the renv environment to install software dependencies

renv::restore()

Set formatting options in the yaml front matter

Some formatting can be configured in the yaml frontmatter of the reporting_template.RMD file

title: "ANALYSIS REPORT"                                # set the main report title
author:
  # - Jane Doe^[Institution Two, jane@example.org]      # add report authors (uncomment if using)
  # - John Doe^[Institution One, john@example.org]      # add a second report author (uncomment if using)
date: "Date: `r format(Sys.time(), '%d/%m/%Y')`"
always_allow_html: true
output:
  bookdown::html_document2:
    toc: true                                           # create a table of contents (true or false)
    toc_depth: 2                                        # set the table of contents depth (number)
    number_sections: false                              # choose whether or not to number sections (true or false)

For example, you can set:

  • Main report title
  • Report authors
  • Set the table of contents depth
  • Choose whether or not to number report sections

Include R code and text relevant to your analyses/report

"Knit" (render) the document

Render document

More information

There is so much more you can do with RMarkdown, get started with wicked reproducible (and interactive!) documents here