R Markdown Recitation Solutions


Jessica Cooperstone

R Markdown Recitation

This will be your template RMarkdown document for playing around with RMarkdown. This was opened using the default Rmd settings. You are going to be playing around with the 3 components of an Rmd:

  1. text
  2. code
  3. the YAML (aka the header)

To see if each of your changes has worked, you will need to knit.


Write text that generates in italics. This text is in italics

Write text that generates in bold This text is in bold

Try playing around with header levels

Biggest header

Second biggest header

Third biggest header

Four biggest header

You get the idea.

Add a hyperlink to our class website

Add an image. Note you will do this differently if you are adding an image from internet vs one you have on your local machine. Also remember your working directory is the location of your Rmd and you may want to have a directory called img where images are stored.

This is my dog Nacho

Add a block quote

Here is an important block quote

Make a bulleted list

  • Thing 1

  • Thing 2

  • Thing 3

  • This also works

  • To make

  • A bulleted list

  1. You can also
  2. Make
  3. Numbered lists


Create a code chunk by typing

Create a code chunk using the toolbar

Create a code chunk using the keyboard shortcut

Write some code within a chunk and execute it

[1] "/Users/jessicacooperstone/Library/CloudStorage/OneDrive-TheOhioStateUniversity/BuckeyeBox Data/JLC_Files/OSU/teaching/data-viz/rdataviz/rmds"

Write some code in line (within your text) and knit

Is it Friday yet?

Try using the different options for your code chunks. Remember you can use multiple at once.

Get code to run but not display

(See it did actually run as it shows up here.)

 [1]  1  2  3  4  5  6  7  8  9 10

Get code to display but not run


Get code to hide messages


Note, this still displays “warnings” which are different from messages. You can hide warnings too but do so with care.


Add a figure caption


Here is my plot about cars

Add alt text


A scatterplot showing the relationship between speed and distance of cars. The two are strongly positively correlated, meaning cars moving at a faster speed go a further distance (I think).

Give your chunk a name

[1] 50  2


Edit the default components of the YAML to be personalized to you

Play around with adding a: Table of contents Code download button Code folding

Play around with the default themes https://www.datadreaming.org/post/r-markdown-theme-gallery/

Play around themes from prettydoc, rmdformats and/or tufte

Other stuff

Play around with the visual editor

Make the table of contents viewable in your document

Back to top