+ - 0:00:00
Notes for current slide
Notes for next slide

00

R Markdown Setting up

Adapted from slides by Alison Hill (RStudio)

Zoë Turner

https://philosopher-analyst.netlify.app/rmd-workshop/

1 / 11

Agenda

RMarkdown

Getting set up ; What's inside?

--------- 10 minutes Break ---------

Text ; Images ; Code chunks

--------- 1 hour Lunch -----------

Inline code ; Tabs

--------- Break ---------

Output Formats ; Parameters; Command Line

--------- 10 minutes Break ---------

Loop reports ; Extras

Finish about 4 - 430pm

2 / 11

?

What is R Markdown - what do you think?

  1. An authoring framework for data science.

  2. A document format (.Rmd).

  3. An R package named rmarkdown.

  4. A file format for making dynamic documents with R.

  5. A tool for integrating prose, code, and results.

  6. A computational document.

  7. Wizardry.

3 / 11

?

4 / 11

Let's get started

1

5 / 11

Checking first...

That everyone is/has:

6 / 11

Checking first...

That everyone is/has:

Also note...

Code doesn't copy to MS Teams with the correct indentations but code can be copied from the slides,

When scripts are opened in the latest version of RStudio and packages are not loaded they will be prompted at the top of the editor to install

6 / 11

Code chunks on the slide have a button in the top right to Copy Code without having to highlight and copy.

Together we'll open an RMarkdown template:

  • Go to File/New File/RMarkdown...
  • A wizard will prompt a Title, Author and Date (in new versions of RStudio)
  • Knit this document and save the file when the wizard appears
7 / 11

It runs extremely quickly but the file must be saved to knit as it creates the .md file and then leaves the output (after clearing away the .md file).

This template is useful for debugging as it works quickly and doesn't rely upon any packages.

Your turn

Time to look at 01-bakeoff-report.Rmd. Look at the source, then 🧶 Knit to HTML.

Try to identify these parts in the source and the output:

  1. The metadata

  2. The text

  3. The code

  4. The output

If this was easy, try to find all code that produces a plot.

02:00
8 / 11

Basic anatomy I

We look at the source anatomy for 01-bakeoff-report.Rmd together:

  1. The metadata

  2. The text

  3. The code

9 / 11

Basic anatomy I

We look at the source anatomy for 01-bakeoff-report.Rmd together:

  1. The metadata

  2. The text

  3. The code

    Basic anatomy II

  4. The output

9 / 11

Point out the parts in the Rmd script. For further documentation on metadata https://rmarkdown.rstudio.com/docs/reference/rmd_metadata.html

Art by Allison Horst

10 / 11

Allison Horst was a resident artist at RStudio in 2019 and produced and shared beautiful artwork to explain statistics and R concepts

Original authors

Alison Hill

@apreshill
@apreshill

Emi Tanaka

@emitanaka
@statsgen

All content is CC-BY. All art (unless otherwise noted) is by Desirée De Leon, CC-BY-NC-ND.

11 / 11

Agenda

RMarkdown

Getting set up ; What's inside?

--------- 10 minutes Break ---------

Text ; Images ; Code chunks

--------- 1 hour Lunch -----------

Inline code ; Tabs

--------- Break ---------

Output Formats ; Parameters; Command Line

--------- 10 minutes Break ---------

Loop reports ; Extras

Finish about 4 - 430pm

2 / 11
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow