Output formats

Session - Creating things from Quarto

Zoë Turner

Wizard

Using the wizard in RStudio gives a selection of output possibilities:

  • html (default and very accessible as well as interactive)
  • word
  • pdf

A full list is on the Quarto documentation website with links to the code to use in the YAML

Rendering to multiple outputs

Whilst it’s possible to list several outputs in the YAML:

format: 
  html:
    toc: true
  docx:
    toc: true

only the first will render with the Render button in RStudio.

Using {quarto} package

The {quarto} package (which is different to Quarto which is in RStudio) can render to different formats:

```{r}
quarto::quarto_render(output_format = "docx")
```

Quarto project

  • This function prompts for the project to be a Quarto project
  • In RStudio this can be set up from the beginning with File > New Project... > Quarto project
  • An additional file called _quarto.yml is generated with code:
project:
  title: "intro-quarto"

And all formats

The following can generate all outputs:

```{r}
quarto::quarto_render(output_format = "all")
```

Run any file

It’s possible to Render any Quarto file (even when not open in RStudio):

```{r}
quarto::quarto_render("images_report/example_report.qmd")
```

Next Section