R Markdown Setup

Setup options recommended in R for Data Science: http://r4ds.had.co.nz/r-markdown.html#chunk-options

Mauro Lepore

2017-07-29

# > There is one chunk name that imbues special behaviour: setup. When you're in
# a notebook mode, the chunk named setup will be run automatically once, before 
# any other code is run.
# --http://r4ds.had.co.nz/r-markdown.html#chunk-options



# Load packages (including data-packages) ----



# Load un-packaged dependencies ----



# Figures ----

# > If you want to make sure the font size is consistent across all your 
# figures, whenever you set out.width, you'll also need to adjust fig.width to 
# maintain the same ratio with your default out.width. For example, if your 
# default fig.width is 6 and out.width is 0.7, when you set out.width = "50%" 
# you'll need to set fig.width to 4.3 (6 * 0.5 / 0.7).
# --http://r4ds.had.co.nz/

set.seed(1014)
options(digits = 3)

knitr::opts_chunk$set(
  echo = TRUE,
  comment = "#>",
  collapse = TRUE,
  cache = TRUE,
  out.width = "70%",
  fig.align = "center",
  fig.width = 6,
  fig.asp = 0.618,  # 1 / phi
  fig.show = "hold"
)

options(dplyr.print_min = 6, dplyr.print_max = 6)