Learning R Markdown in one Hour
In this session our goal is to:
- Learn and use many of the features of Rmarkdown
- See how to intermix R code with text
- Collaboratively write a document to illustrate how Rmarkdown works
The crazy thing is that, even though Rmarkdown provides an incredibly powerful tool for authoring reproducible research documents, you really can learn most of the fundamentals in about an hour.
Rmarkdown Setup
- If you completed Assignment 2 you will understand what we are about to be doing.
- I hope everyone got the email I sent with the directions on getting the repository before you landed in the internet-impoverished conference room at NMFS. If not, here they are again:
- Open RStudio
- Choose File->New Project
- When asked, choose “Create Project from Version Control”
- Then when asked choose “Git”
- For repository URL use this: https://github.com/eriqande/grandma-recipe.git
- Let the project directory be named grandma-recipe
- Put it somewhere. I chose my Desktop.
- Hit “Create Project” and you should be in business.
A few words about Markdown
- Designed as a text markup language that would be
- Simple
- Expressive
- Intuitive
- Capable of conveying intent even without being compiled into HTML or PDF
- There are many Markdown interpreters. The Rstudio folks have been using pandoc to crunch Markdown into other formats. It provides many useful extensions.
- Customizations of style are mostly separate from the content.
Mardown as “Reproducibility in Report Generation”
- One nice thing about Markdown is that if you want to see how someone did something and you can find their R Markdown source then you can just look at it and see what they did.
- Contrast this to trying to explain to someone how to get a certain type of formatting in MS Word.
Learn this in an hour?!
- Yes, we really can. It’s simple and intuitive.
- I’ve prepared a document in Rmarkdown using a lot of its features and now we will go through it together to discuss them.
- You assignment for next week is to write document using all the same features to describe yourself and your research.
comments powered by Disqus