-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsend_rendered_report.qmd
46 lines (36 loc) · 1.36 KB
/
send_rendered_report.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
title: "Send a rendered report"
format: html
---
```{r}
suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(gmailr))
suppressPackageStartupMessages(library(quarto))
suppressPackageStartupMessages(library(here))
source("send_gmail.R")
```
In the following code:
- The `input` parameter points to the Quarto file that you want to render and send. That file needs to have certain YAML parameters, as follows, so that graphs are embedded in the HTML:
+---------------------------+
| ``` |
| format: |
| html: |
| embed-resources: true |
| ``` |
+---------------------------+
- The `output_format` parameter seems to be necessary if the `.qmd` file is going to generate graphics, specifically, even though `html` is specified in the report's YAML.
- The `output_file` allows for different versions of the output to be sent, for example, to different audiences.
```{r}
quarto::quarto_render(input = "quarto_default.qmd",
output_format = "html",
output_file = "ready_to_send.html")
```
```{r}
body <- as.character(read_file(here("ready_to_send.html")))
send_gmail(
"Here is a quarto report with graphs embedded",
body
)
```