Generate Reports With R Markdown
Tips before you start. If you haven’t done so already, please do the following:
- Pull up documentation for a function by executing
?function
in the Console. - Install LaTeX in RStudio:
install.packages('tinytex') tinytex::install_tinytex()
- Read parts 1 - 6 of the RMarkdown Cheat Sheet
- For the rest of the workshop, we will save our code on a R Markdown file. Let’s create this file in RStudio. The steps are similar to described in the cheatsheet.
- Open RStudio, click File -> New File -> RMarkdown…
- Enter title, author, and select the type of output format PDF and click OK
- After creating your R Markdown file, you must save it. Click File -> Save As ->… Enter the filename and make sure to remember where you saved it.
- The Markdown document with some example code will appear on your Editor window.
- Click the Knit icon in the toolbar (see right). A PDF file is now generated and saved to the current folder/directory.
- Continue editing this R Markdown document for other Activities.