Templates for markdown files in R

W. Francuzik
6.07.2016 @BerlinRUg

Why do we need templates in R Markdown

  • speed (load default libs, data sets, files etc.)
  • consistency
  • ease
  • conformity (you are less likely to forget crucial points)

An example of use

The weekly report:

  • repetitive
  • similar
  • must include certain analyses

Where do they exist in RStudio?

where

Are there any already availible?

Are there any already availible?

temp2

Are there any already availible?

The rticles package provides a suite of custom R Markdown LaTeX formats and templates for varoius formats, including:

  • JSS articles

  • R Journal articles

  • CTeX documents

  • ACM articles

  • ACS articles

  • Elsevier journal submissions

How to create your own?

  • you need to create a package
  • you need a defined file structure
  • you need two files one yaml and one Rmd

File structure

Directory: inst/rmarkdown/templates/my_template

template.yaml 
skeleton/skeleton.Rmd 
skeleton/logo.png 
skeleton/styles.css 

YAML file

template.yaml

name: My Template
create_dir: true

File structure

skeleton/skeleton.Rmd

---
title: "Untitled"
output:
  html_document:
    toc: true
    fig_caption: true
---

## Overview

## Analysis

Have fun!