Marcio Diniz | Michael Luu
Cedars Sinai Medical Center
31 August, 2022
R-Markdown / Quarto embodies the idea of ‘literate programming’ from Donald Knuth, where you should think of programs as ‘works of literature’.
This idea is an effort that pushes to blend your literature (text) and your program (code) together, where we can read from top to bottom.
As an investigator, you are a story teller with your data
When to use R-Markdown / Quarto vs R Scripts
Everyone has their own style, and there’s no ‘right way’ or ‘wrong way’
In this course we will be promoting the use of R-Markdown / Quarto
R Scripts are typically used when we don’t need to incorporate in our code
R-Markdown / Quarto is typically used when we want to form a narrative about our code and results
We can create a Quarto Document by clicking on the plus symbol on the top left corner of Rstudio
We can then next select the Quarto Document
A new window will open, where we can define the parameters of the Quarto Document
Quarto supports outputs such as HTML, PDF, and WORD
For the purpose of this class we will focus on HTML outputs
Feel free to include a title for your document as well as your name as the author
Please keep Engine as Knitr
Please leave ‘Use visual markdown editor’ unchecked for now
ALL PARAMETERS CAN BE CHANGED LATER!
Great! You now have your very first Quarto Document
This is currently the ‘Source’ view of the quarto document
Rstudio also has a ‘Visual’ editor that we can switch between that is more akin to Microsoft Word
Everything done in the visual editor gets translated to source (Code), and you can switch between them at any time.
This section is considered the ‘YAML’
Within this section, you can customize certain parameters of the document such as the title, author, and format
Everything inside the shaded section is called a ‘code chunk’
Everything inside this section is interpreted as R code
We won’t have the opportunity to go into great depth outside of the basics in report generation, however you can learn more about the capabilities of R markdown from this book.