@@ -9,7 +9,8 @@ vignette: >
9
9
%\VignetteEncoding{UTF-8}
10
10
---
11
11
12
- ``` {r, include = FALSE}
12
+ ``` {r}
13
+ #| include: false
13
14
knitr::opts_chunk$set(
14
15
collapse = TRUE,
15
16
comment = "#>",
@@ -18,15 +19,17 @@ knitr::opts_chunk$set(
18
19
)
19
20
```
20
21
21
- ``` {r, include = FALSE}
22
+ ``` {r}
23
+ #| include: false
22
24
library(tibble)
23
25
library(formattable)
24
26
library(dplyr)
25
27
library(tidyr)
26
28
library(ggplot2)
27
29
```
28
30
29
- ``` {r setup}
31
+ ``` {r}
32
+ #| label: setup
30
33
library(tibble)
31
34
```
32
35
@@ -42,7 +45,8 @@ tbl <- tibble(x = digits(9:11, 3))
42
45
tbl
43
46
```
44
47
45
- ``` {r echo = FALSE}
48
+ ``` {r}
49
+ #| echo: false
46
50
vec_ptype_abbr.formattable <- function(x, ...) {
47
51
"dbl:fmt"
48
52
}
@@ -98,7 +102,9 @@ stocks %>%
98
102
99
103
For ggplot2 we need to do [ some work] ( https://github.com/tidyverse/ggplot2/pull/4065 ) to show apply the formatting to the scales.
100
104
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
102
108
library(ggplot2)
103
109
104
110
# Needs https://github.com/tidyverse/ggplot2/pull/4065 or similar
@@ -110,7 +116,9 @@ stocks %>%
110
116
It pays off to specify formatting very early in the process.
111
117
The diagram below shows the principal stages of data analysis and exploration from "R for data science".
112
118
113
- ``` {r echo = FALSE, eval = (Sys.getenv("IN_GALLEY") == "")}
119
+ ``` {r}
120
+ #| echo: false
121
+ #| eval: !expr (Sys.getenv("IN_GALLEY") == "")
114
122
text <- paste(
115
123
readLines(here::here("vignettes/r4ds.mmd")),
116
124
collapse = "\n"
@@ -122,7 +130,9 @@ The subsequent diagram adds data formats, communication options, and explicit da
122
130
The original r4ds transitions are highlighted in bold.
123
131
There are two principal options where to apply formatting for results: right before communicating them, or right after importing.
124
132
125
- ``` {r echo = FALSE, eval = (Sys.getenv("IN_GALLEY") == "")}
133
+ ``` {r}
134
+ #| echo: false
135
+ #| eval: !expr (Sys.getenv("IN_GALLEY") == "")
126
136
text <- paste(
127
137
readLines(here::here("vignettes/formats.mmd")),
128
138
collapse = "\n"
0 commit comments