```{r}
knitr::opts_chunk$set(echo = FALSE)
```โ FAQs
What are the pros and cons of using .HTML as a dashboard/report format?
โ Pros
A HTML file is just a file. Theyโre extremely portable and can be opened anywhere. All that your users need is a web browser, thereโs no dependency on Word, Adobe Reader, or any specific programme. You can put them on SharePoint, host them on a website or just share them the same way you would share any file.
HTML files are also great for interactive content. HTML files lets you include:
- interactive plots,
- filterable, sortable tables
- zoomable maps
- any other HTML widgets
โ Cons
Some users find them weird. HTML dashboards just arenโt as common as PDF or Word documents. So people donโt understand that a HTML file doesnโt mean itโs online.
There also isnโt an easy way to suggest edits in a HTML file. You canโt track changes or highlight text easily directly in the HTML file which makes it less good for quick feedback.
How do I hide code in my Quarto reports?
By default, Quarto shows code and itโs output. If you only want the output (e.g., a plot or table), you have two options:
Hide code for a single chunk
```{r}
#| echo: false
plot(cars)
```Or it you can hide code for the whole document by default by adding this to your YAML header:
---
execute:
echo: false
---
๐ Learn more about code chunk execution options
How do I add alt text to my plots?
Alt text is essential for accessibility. You can define it with the fig-alt chunk option:
```{r}
#| fig-alt: "A scatterplot showing car speed (4โ25 mph) on the x-axis and stopping distance (2โ120 ft) on the y-axis. Points trend upward, indicating that higher speeds are associated with longer stopping distances. The relationship is roughly linear but with increasing spread at higher speeds."
plot(cars)
```Iโm moving from RMarkdown to Quarto - what are the key differences?
- R Markdown uses
.Rmdfiles, Quarto uses.qmd - R Markdown relies on the {knitr} and {rmarkdown} R packages, Quarto has its own engine and command-line tool you need to install
- RMarkdown was built for R users. Quarto is language agnostic (R, Python, Julia, Observable)
One of the main practical differences for users is the define global chunk options. In R Markdown, you have to include a set up code chunk at the top of your document.
In Quarto, you specify your document-wide options in the YAML at the start of the document. Much neater!1
---
title: "Title"
format: html
execute:
echo: false
---
๐ Learn more about the differences between RMarkdown and Quarto
How do I brand my Quarto reports?
The way you style and brand your report depends on the format:
HTML โ CSS / SASS
format:
html:
theme: styles.css
PDF โ LaTeX template
format:
pdf:
template: mytemplate.tex
Word โ Word reference document
format:
docx:
reference-doc: template.docx
๐ Learn more about themeing Quarto documents
You can also use brand.yml. Posit created a unified branding tool that lets you set basic colours and fonts consistently across Quarto, Shiny, and ggplot2.
Can I loop over parameters to generate multiple reports?
Yes! Hereโs a minimal example that usese the {quarto} R package to programmatically render multiple reports.
data(diamonds, package = "ggplot2")
cuts <- unique(diamonds$cut) # Parameter in your report
# Build report instructions
reports <- tibble::tibble(
input = "diamonds.qmd",
output_file = stringr::str_glue("{cuts}.html"),
execute_params = purrr::map(cuts, ~ list(cut = .x))
)
# Render all reports
purrr::pwalk(
reports,
~ quarto::quarto_render(input = ..1, output_file = ..2, execute_params = ..3)
)You could also write some bash script if you wanted to use the Quarto CLI instead of R.
๐ Learn more about parameterised reports
Footnotes
And easier to remember!โฉ๏ธ