Skip to content

Instantly share code, notes, and snippets.

@tjmahr
Last active November 17, 2015 03:43
Show Gist options
  • Save tjmahr/0899b8bac535b7862195 to your computer and use it in GitHub Desktop.
Save tjmahr/0899b8bac535b7862195 to your computer and use it in GitHub Desktop.

Good idea or bad idea for YAML metadata?

---
title: "My report"
author: "Tristan Mahr"
output: html_document
params:
  knitr_chunks: !r 
    knitr::opts_chunk$set(comment = "#>", 
                          collapse = TRUE, 
                          fig.align = "center")
  knitr_knit: !r 
    knitr::opts_knit$set(root.dir = "../")
---
@rmflight
Copy link

Curious why you can't just set those knitr options in the first chunk at the top of the document?

@tjmahr
Copy link
Author

tjmahr commented Nov 17, 2015

Of course I can. No reason not to either. Eventually, somehow, I'd like to use the same knitr options in several related documents, and factoring out the options into a single definition, using a yaml block, seems like the best route to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment