---
title:  Learning R Markdown in one Hour
layout: default_with_disqus
author: Eric C. Anderson
output: bookdown::html_chapter
---

# Learning R Markdown in one Hour {#rmarkdown-in-an-hour}

In this session our goal is to:

1. Learn and use many of the features of Rmarkdown
1. See how to intermix R code with text
1. 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 {#rmarkdown-setup}

* If you completed [Assignment 2](http://eriqande.github.io/rep-res-web/assign/assign-2.html#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:
    1. Open RStudio
    2. Choose File->New Project
    3. When asked, choose "Create Project from Version Control"
    4. Then when asked choose "Git"
    5. For repository URL use this:    https://github.com/eriqande/grandma-recipe.git
    6. Let the project directory be named grandma-recipe
    7. Put it somewhere.  I chose my Desktop.
    8. 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](http://johnmacfarlane.net/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.

