Skip to content

Commit

Permalink
docs: Fix rendering if suggested packages are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Nov 5, 2023
1 parent 15db776 commit 8294c2b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions vignettes/formats.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ vignette: >
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
eval = rlang::is_installed(c("dplyr", "formattable", "ggplot2", "tidyr")),
error = (Sys.getenv("IN_PKGDOWN") == "")
)
```

```{r, include = FALSE}
library(tibble)
library(formattable)
library(dplyr)
Expand Down
2 changes: 1 addition & 1 deletion vignettes/numbers.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ The formatting survives most data transformations.
Currently, formatting must be applied manually for each column.
The following pattern may help doing this consistently for all columns in a tibble, or for some columns based on their name.

```{r}
```{r, eval = rlang::is_installed("dplyr")}
library(dplyr, warn.conflicts = FALSE)
markets <-
Expand Down
10 changes: 7 additions & 3 deletions vignettes/types.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ vignette: >
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
eval = rlang::is_installed(c("dplyr", "tidyr", "purrr")),
comment = "#>"
)
```

```{r, include = FALSE}
library(dplyr)
library(tidyr)
library(purrr)
Expand Down Expand Up @@ -48,7 +52,7 @@ set_names(rep_along(all_methods, list("")), all_methods) %>%


```{r data, echo = FALSE}
data <- list(
data <- compact(list(
"Atomic" = rlang::quos(
logical = TRUE,
integer = 1L,
Expand All @@ -68,7 +72,7 @@ data <- list(
difftime = vctrs::new_duration(1)
),
"Objects from other packages" = rlang::quos(
"Objects from other packages" = if (rlang::is_installed(c("bit64", "blob", "hms"))) rlang::quos(
hms = hms::hms(1),
integer64 = bit64::as.integer64(1e10),
blob = blob::blob(raw(1))
Expand Down Expand Up @@ -99,7 +103,7 @@ data <- list(
expression = parse(text = "a <- 1\nb<- 2"),
quosures = rlang::quos(a = 1)
)
)
))
```

```{r table, echo = FALSE}
Expand Down

0 comments on commit 8294c2b

Please sign in to comment.