+
+
+
+
+
+Quarto is an alternative approach to R Markdown for creating automated, reproducible reports, presentations and interactive dashboards. Quarto was developed by the team behind R Studio, to take the functionality of R Markdown, with other approaches, and combine them into a single consistent system.
+As the overall philosophy and syntax of Quarto is nearly identical to that of R Markdown, this chapter will not focus on these, and instead refer you to the R Markdown chapter for instructions on syntax and application. We will approach the following topics:
+
+- Why Quarto over R Markdown?
+- How to get started in Quarto.
+- Going beyond reports to dashboards and interactive documents.
+
+
+ Why Quarto over R Markdown?
+Quarto provides the flexibility and automation that R Markdown pioneered, with a more powerful underlying flexibility that streamlines a lot of the sharing and publishing processes of your work! While R Markdown is tied to R, Quarto documents allow you to use a number of different programming languages such as R, Python, Javascript and Julia. This means that if you are working with people writing in several different coding languages, they can all use the same document to carry out their analysis.
+Even if you are only working in R, Quarto has several advantages. Rather than relying on individual packages to create different outputs, Quarto handles this all internally. To produce a website, PowerPoint slides, or a html report, rather than using external packages, Quarto has this functionality inbuilt. This means you have fewer packages to update, and if one of the packages is no longer maintained, you don’t need to change your approach to maintain the same output.
+Quarto also has the advantage of providing a way to render multiple files at the same time, and combine them when wanted. The Epi R Handbook is written as several individual Quarto files, and then combined to make this website!
+If you are thinking of moving over from R Markdown to Quarto, don’t worry, you won’t have to re-write every R Markdown document to move over to Quarto! Quarto documents follow the same syntax and commands as Rmarkdown. Previous scripts in R Markdown can generally be moved over to Quarto without changing any of your code!
+Below is the pipeline through which Quarto documents are created, as you can see it is very similar to the R Markdown pipeline, other than the initial file type as changed.
+
+Source
+
+
+ Getting started
+Creating a Quarto document does not require us to download an additional package, unlike R Markdown which requires the rmarkdown package. Additionally, you do not need to install LaTex, as you do with R Markdown, as Quarto contains built in functionality.
+Functionally, Quarto works the same way as R Markdown. You create your Quarto script (instead of your R Markdown file), write your code, and knit the document.
+First, just like when you create an R Markdown document in Rstudio you start with File
, then New file
, then R Markdown
.
+
+You will then get a number of different options to choose. Here we will select “HTML” to create an html document. All these details can be changed later in the document, so do not worry if you change your mind later.
+
+This will create your new Quarto script. Note: While the R Markdown scripts ended with .Rmd, Quarto scripts end with .qmd
+While R Markdown scripts set the working directory to wherever the file is located, Quarto documents retain the original working directory. This is especially useful when you are working with an R Project.
+Your first view of the Quarto document may look different to what you are use to with an R Markdown document. This is because Quarto has the additional functionality of allow you to see what the rendered document will look like after it has been knit. To switch between the “Visual” and “Source” mode (which is what you see when you create an R Markdown document), click the “Visual” button in the top left side of the script.
+
+You are now ready to code your Quarto script! The syntax and approach is the same as creating an R Markdown document, so see the chapter on Reports with R Markdown for guidance and inspiration.
+Here is an example of what a Quarto script for analysing our linelist
data set might look like.
+
+And here is what the output looks like.
+
+
+
+ Moving beyond simple reports
+You may want to move beyond creating simple, static, reports to interactive dashboards and outputs, like you can in R Markdown. Luckily you can do all of this in Quarto, using inbuilt functionality, and other packages like Shiny! For an example of how far you can take your Quarto scripts, see this Quarto Gallery.
+
+
+
+