Introducing RStudio and R Markdown

Gettin’ giffy wit it.

Shannon Pileggi
09-07-2020

Table of Contents


TL; DR

RStudio has some wonderful features! Here are some tips and tricks for new learneRs to get started with regards to customizing your interface, getting started with R Markdown, and a bit of troubleshooting.

Background

Gif’s were captured in May 2019, likely with RStudio version 1.2.1335-1. Keyboard shortcuts are for Windows users, Mac users may differ. For Windows users, I also recommend changing your default settings to show file extensions.

And if you are not familiar with it, please allow me introduce you to Will Smith’s 1998 hit “Gettin’ Jiggy Wit It.” 🎵Na na na na na na na nana 🎵

Customizing the interface

Adjusting panels

Re-arrange panels

Tools -> Global Options -> Panel Layout

Recover lost panels

Font size/resolution

View -> Zoom in / Zoom out / Actual size

Personalization

Tools -> Global Options -> Appearance

Margin column

Tools -> Global Options -> Code -> Display -> Show margin -> Margin column 80

Consider placing a margin column at 80 characters as a reminder for code formatting. Keeping code within 80 characters can make it easier to read when switching displays or sharing code.

R Markdown

Opening a new R Markdown

File -> New file -> R Markdown    or    -> R Markdown

Knitting an R Markdown

Preview an R Markdown

Personalizing R Markdown

Inserting/splitting code chunks

   or    Ctrl + Alt + I

Chunk anatomy

Chunk names

Chunk names allow you to quickly navigate code, automatically name figures, and troubleshoot errors. Chunk names must be unique! If no name is provided, a default numbered chunk name will be assigned.

Chunk execution

   or    Ctrl + Enter

Chunk options

R Markdown Troubleshooting

YAML error

Chunk error

Chunk error for duplicate chunk name

Layout error

Let your markdown breathe! If something doesn’t look right, try adding white space.

R code error

The end

Acknowledgments

Thumbnail artwork adapted from @allison_horst.

The phrase IDE was removed from the title and body of this post on Sep. 8, 2020 per @TrashBirdEcol’s suggestion.

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Pileggi (2020, Sept. 7). PIPING HOT DATA: Introducing RStudio and R Markdown. Retrieved from https://www.pipinghotdata.com/posts/2020-09-07-introducing-the-rstudio-ide-and-r-markdown/

BibTeX citation

@misc{pileggi2020introducing,
  author = {Pileggi, Shannon},
  title = {PIPING HOT DATA: Introducing RStudio and R Markdown},
  url = {https://www.pipinghotdata.com/posts/2020-09-07-introducing-the-rstudio-ide-and-r-markdown/},
  year = {2020}
}