diff --git a/R/draw-dm.R b/R/draw-dm.R index 8ac643bda9..a6eea39004 100644 --- a/R/draw-dm.R +++ b/R/draw-dm.R @@ -20,7 +20,7 @@ #' @return For `dm_draw()`: returns an object of class `grViz` (see also [DiagrammeR::grViz()]), which, #' when printed, produces the output seen in the viewer as a side effect. #' -#' @examples +#' @examplesIf rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR") #' dm_nycflights13() %>% #' dm_draw() #' @@ -131,7 +131,9 @@ dm_get_all_columns <- function(x) { #' @return For `dm_set_colors()`: the updated data model. #' #' @rdname dm_draw -#' @examples +#' +#' @export +#' @examplesIf rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR") #' #' dm_nycflights13(color = FALSE) %>% #' dm_set_colors( @@ -149,7 +151,6 @@ dm_get_all_columns <- function(x) { #' dm_nycflights13(color = FALSE) %>% #' dm_set_colors(!!!nyc_cols) %>% #' dm_draw() -#' @export dm_set_colors <- function(dm, ...) { quos <- enquos(...) if (any(names(quos) == "")) abort_only_named_args("dm_set_colors", "the colors") diff --git a/R/foreign-keys.R b/R/foreign-keys.R index c6283f208e..615661a84c 100644 --- a/R/foreign-keys.R +++ b/R/foreign-keys.R @@ -32,7 +32,7 @@ #' @return For `dm_add_fk()`: An updated `dm` with an additional foreign key relation. #' #' @export -#' @examplesIf rlang::is_installed("nycflights13") +#' @examplesIf rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR") #' nycflights_dm <- dm( #' planes = nycflights13::planes, #' flights = nycflights13::flights @@ -212,8 +212,7 @@ dm_get_all_fks_impl <- function(dm) { #' @return For `dm_rm_fk()`: An updated `dm` without the given foreign key relation. #' #' @export -#' @examples -#' +#' @examplesIf rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR") #' dm_nycflights13(cycle = TRUE) %>% #' dm_rm_fk(flights, dest, airports) %>% #' dm_draw() diff --git a/R/primary-keys.R b/R/primary-keys.R index 1b83776cb8..6ce16b57a3 100644 --- a/R/primary-keys.R +++ b/R/primary-keys.R @@ -29,7 +29,7 @@ #' @return For `dm_add_pk()`: An updated `dm` with an additional primary key. #' #' @export -#' @examplesIf rlang::is_installed("nycflights13") +#' @examplesIf rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR") #' nycflights_dm <- dm( #' planes = nycflights13::planes, #' airports = nycflights13::airports @@ -208,8 +208,7 @@ dm_get_all_pks_impl <- function(dm) { #' #' @return For `dm_rm_pk()`: An updated `dm` without the indicated primary key. #' -#' @examples -#' +#' @examplesIf rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR") #' dm_nycflights13() %>% #' dm_rm_pk(airports, rm_referencing_fks = TRUE) %>% #' dm_draw() diff --git a/R/zoom.R b/R/zoom.R index fe3707e07b..d9bf487727 100644 --- a/R/zoom.R +++ b/R/zoom.R @@ -47,7 +47,7 @@ #' @return For `dm_zoom_to()`: A `zoomed_dm` object. #' #' @export -#' @examples +#' @examplesIf rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR") #' flights_zoomed <- dm_zoom_to(dm_nycflights13(), flights) #' #' flights_zoomed diff --git a/man/dm_add_fk.Rd b/man/dm_add_fk.Rd index a128fa5e7b..81dc8d466f 100644 --- a/man/dm_add_fk.Rd +++ b/man/dm_add_fk.Rd @@ -52,7 +52,7 @@ with current semantics. } \examples{ -\dontshow{if (rlang::is_installed("nycflights13")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} nycflights_dm <- dm( planes = nycflights13::planes, flights = nycflights13::flights @@ -66,10 +66,11 @@ nycflights_dm \%>\% dm_add_fk(flights, tailnum, planes) \%>\% dm_draw() \dontshow{\}) # examplesIf} - +\dontshow{if (rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} dm_nycflights13(cycle = TRUE) \%>\% dm_rm_fk(flights, dest, airports) \%>\% dm_draw() +\dontshow{\}) # examplesIf} } \seealso{ Other foreign key functions: diff --git a/man/dm_add_pk.Rd b/man/dm_add_pk.Rd index 23fcfb55da..9dffb7e1a7 100644 --- a/man/dm_add_pk.Rd +++ b/man/dm_add_pk.Rd @@ -53,7 +53,7 @@ with current semantics. } \examples{ -\dontshow{if (rlang::is_installed("nycflights13")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} nycflights_dm <- dm( planes = nycflights13::planes, airports = nycflights13::airports @@ -74,10 +74,11 @@ try( dm_add_pk(planes, manufacturer, check = TRUE) ) \dontshow{\}) # examplesIf} - +\dontshow{if (rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} dm_nycflights13() \%>\% dm_rm_pk(airports, rm_referencing_fks = TRUE) \%>\% dm_draw() +\dontshow{\}) # examplesIf} } \seealso{ Other primary key functions: diff --git a/man/dm_draw.Rd b/man/dm_draw.Rd index 139b98ab6a..51dd6bcffa 100644 --- a/man/dm_draw.Rd +++ b/man/dm_draw.Rd @@ -80,6 +80,7 @@ These are the standard colors also returned by \code{grDevices::colors()} plus a table color with the name "default". } \examples{ +\dontshow{if (rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} dm_nycflights13() \%>\% dm_draw() @@ -91,6 +92,8 @@ length(dm_get_available_colors()) dm_nycflights13() \%>\% dm_get_colors() +\dontshow{\}) # examplesIf} +\dontshow{if (rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} dm_nycflights13(color = FALSE) \%>\% dm_set_colors( @@ -108,4 +111,5 @@ nyc_cols dm_nycflights13(color = FALSE) \%>\% dm_set_colors(!!!nyc_cols) \%>\% dm_draw() +\dontshow{\}) # examplesIf} } diff --git a/man/dm_zoom_to.Rd b/man/dm_zoom_to.Rd index 48539cacbd..8f50da892a 100644 --- a/man/dm_zoom_to.Rd +++ b/man/dm_zoom_to.Rd @@ -90,6 +90,7 @@ The join-methods for \code{zoomed_dm} have an extra argument \code{select} that And -- last but not least -- also the {tidyr}-functions \code{unite()} and \code{separate()} are supported for \code{zoomed_dm}. } \examples{ +\dontshow{if (rlang::is_installed("nycflights13") && rlang::is_installed("DiagrammeR")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} flights_zoomed <- dm_zoom_to(dm_nycflights13(), flights) flights_zoomed @@ -116,4 +117,5 @@ flights_zoomed_transformed \%>\% # discard the zoomed table flights_zoomed_transformed \%>\% dm_discard_zoomed() +\dontshow{\}) # examplesIf} }