Skip to content

Commit 2ddda70

Browse files
committed
chore: Use Quarto-style formatting in vignettes
1 parent fec033a commit 2ddda70

File tree

12 files changed

+678
-214
lines changed

12 files changed

+678
-214
lines changed

tests/testthat/vignettes/digits.Rmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ vignette: >
88
%\VignetteEncoding{UTF-8}
99
---
1010

11-
```{r setup, include = FALSE}
11+
```{r}
12+
#| label: setup
13+
#| include: false
1214
library(tibble)
1315
set.seed(1014)
1416
knitr::opts_chunk$set(

tests/testthat/vignettes/formats.Rmd

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ vignette: >
99
%\VignetteEncoding{UTF-8}
1010
---
1111

12-
```{r, include = FALSE}
12+
```{r}
13+
#| include: false
1314
knitr::opts_chunk$set(
1415
collapse = TRUE,
1516
comment = "#>",
@@ -18,15 +19,17 @@ knitr::opts_chunk$set(
1819
)
1920
```
2021

21-
```{r, include = FALSE}
22+
```{r}
23+
#| include: false
2224
library(tibble)
2325
library(formattable)
2426
library(dplyr)
2527
library(tidyr)
2628
library(ggplot2)
2729
```
2830

29-
```{r setup}
31+
```{r}
32+
#| label: setup
3033
library(tibble)
3134
```
3235

@@ -42,7 +45,8 @@ tbl <- tibble(x = digits(9:11, 3))
4245
tbl
4346
```
4447

45-
```{r echo = FALSE}
48+
```{r}
49+
#| echo: false
4650
vec_ptype_abbr.formattable <- function(x, ...) {
4751
"dbl:fmt"
4852
}
@@ -98,7 +102,9 @@ stocks %>%
98102

99103
For ggplot2 we need to do [some work](https://github.com/tidyverse/ggplot2/pull/4065) to show apply the formatting to the scales.
100104

101-
```{r, eval = (Sys.getenv("IN_GALLEY") == ""), fig.alt="Example plot showing stock over time, separated by id"}
105+
```{r}
106+
#| eval: !expr (Sys.getenv("IN_GALLEY") == "")
107+
#| fig-alt: Example plot showing stock over time, separated by id
102108
library(ggplot2)
103109
104110
# Needs https://github.com/tidyverse/ggplot2/pull/4065 or similar
@@ -110,7 +116,9 @@ stocks %>%
110116
It pays off to specify formatting very early in the process.
111117
The diagram below shows the principal stages of data analysis and exploration from "R for data science".
112118

113-
```{r echo = FALSE, eval = (Sys.getenv("IN_GALLEY") == "")}
119+
```{r}
120+
#| echo: false
121+
#| eval: !expr (Sys.getenv("IN_GALLEY") == "")
114122
text <- paste(
115123
readLines(here::here("vignettes/r4ds.mmd")),
116124
collapse = "\n"
@@ -122,7 +130,9 @@ The subsequent diagram adds data formats, communication options, and explicit da
122130
The original r4ds transitions are highlighted in bold.
123131
There are two principal options where to apply formatting for results: right before communicating them, or right after importing.
124132

125-
```{r echo = FALSE, eval = (Sys.getenv("IN_GALLEY") == "")}
133+
```{r}
134+
#| echo: false
135+
#| eval: !expr (Sys.getenv("IN_GALLEY") == "")
126136
text <- paste(
127137
readLines(here::here("vignettes/formats.mmd")),
128138
collapse = "\n"

0 commit comments

Comments
 (0)