From 22725673e2d584af728ae193f488b1f408f74e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 22 Nov 2024 17:49:38 +0100 Subject: [PATCH] Examples --- R/ctl_new_pillar_list.R | 2 +- R/options.R | 2 +- R/pillar-package.R | 2 +- man/ctl_new_pillar_list.Rd | 2 +- man/pillar-package.Rd | 2 ++ man/pillar_options.Rd | 3 ++- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/R/ctl_new_pillar_list.R b/R/ctl_new_pillar_list.R index cc933626e..2f67228ad 100644 --- a/R/ctl_new_pillar_list.R +++ b/R/ctl_new_pillar_list.R @@ -42,7 +42,7 @@ #' for a compound pillar (or the pillar itself for a simple pillar) #' has been constructed already. #' @export -#' @examplesIf rlang::is_installed("palmerpenguins") && requireNamespace("tibble") +#' @examplesIf rlang::is_installed(c("palmerpenguins", "tibble")) && requireNamespace("tibble") #' # Simple column #' ctl_new_pillar_list( #' tibble::tibble(), diff --git a/R/options.R b/R/options.R index 053709d7b..43e2fc4ff 100644 --- a/R/options.R +++ b/R/options.R @@ -7,7 +7,7 @@ #' @usage NULL #' @format NULL #' -#' @examples +#' @examplesIf rlang::is_installed("tibble") #' df <- tibble::tibble(x = c(1.234567, NA, 5:10)) #' df #' diff --git a/R/pillar-package.R b/R/pillar-package.R index a40eac5b2..58e10ed07 100644 --- a/R/pillar-package.R +++ b/R/pillar-package.R @@ -12,7 +12,7 @@ #' - [print.tbl()] for formatting data-frame-like objects, #' - [pillar_options] for a list of package options. #' -#' @examples +#' @examplesIf rlang::is_installed("tibble") #' pillar(1:3) #' pillar(c(1, 2, 3)) #' pillar(factor(letters[1:3]), title = "letters") diff --git a/man/ctl_new_pillar_list.Rd b/man/ctl_new_pillar_list.Rd index bfa947db3..3662fd805 100644 --- a/man/ctl_new_pillar_list.Rd +++ b/man/ctl_new_pillar_list.Rd @@ -65,7 +65,7 @@ and with \code{first_pillar} set to the pillar object constructed in the first call. } \examples{ -\dontshow{if (rlang::is_installed("palmerpenguins") && requireNamespace("tibble")) withAutoprint(\{ # examplesIf} +\dontshow{if (rlang::is_installed(c("palmerpenguins", "tibble")) && requireNamespace("tibble")) withAutoprint(\{ # examplesIf} # Simple column ctl_new_pillar_list( tibble::tibble(), diff --git a/man/pillar-package.Rd b/man/pillar-package.Rd index 33cf7b225..602d969af 100644 --- a/man/pillar-package.Rd +++ b/man/pillar-package.Rd @@ -12,10 +12,12 @@ using the full range of colours provided by modern terminals. Provides various generics for making every aspect of the display customizable. } \examples{ +\dontshow{if (rlang::is_installed("tibble")) withAutoprint(\{ # examplesIf} pillar(1:3) pillar(c(1, 2, 3)) pillar(factor(letters[1:3]), title = "letters") tbl_format_setup(tibble::as_tibble(mtcars), width = 60) +\dontshow{\}) # examplesIf} } \seealso{ \itemize{ diff --git a/man/pillar_options.Rd b/man/pillar_options.Rd index d044321b4..608e4bfa4 100644 --- a/man/pillar_options.Rd +++ b/man/pillar_options.Rd @@ -75,6 +75,7 @@ and to \code{FALSE} otherwise. } \examples{ +\dontshow{if (rlang::is_installed("tibble")) withAutoprint(\{ # examplesIf} df <- tibble::tibble(x = c(1.234567, NA, 5:10)) df @@ -90,6 +91,6 @@ df # Change back to the original value: options(old) df - +\dontshow{\}) # examplesIf} } \keyword{datasets}