โ“ 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:

โŒ 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
---
Tip

๐Ÿ“š 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 .Rmd files, 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.

```{r}
knitr::opts_chunk$set(echo = FALSE)
```

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
---
Tip

๐Ÿ“š 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
Tip

๐Ÿ“š 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.

Tip

๐Ÿ“š Learn more about parameterised reports

Footnotes

  1. And easier to remember!โ†ฉ๏ธŽ