diff --git a/R/print.R b/R/print.R index 17c43062..09990b06 100644 --- a/R/print.R +++ b/R/print.R @@ -64,6 +64,8 @@ print.ggvis <- function(x, dynamic = NA, launch = interactive(), ...) { #' @param plot_id Unique identifier used to identify the plot on the page. #' @param dest Deprecated (this no longer works). #' @examples +#' ## Run these examples only in interactive R sessions +#' if (interactive()) { #' # In most cases view_static is unnecessary; these will do the same thing: #' mtcars %>% ggvis(~wt, ~mpg) #' mtcars %>% ggvis(~wt, ~mpg) %>% view_static() @@ -71,6 +73,7 @@ print.ggvis <- function(x, dynamic = NA, launch = interactive(), ...) { #' # Can find the output file with view_static() and html_print() #' outfile <- mtcars %>% ggvis(~wt, ~mpg) %>% #' view_static() %>% htmltools::html_print(viewer = NULL) +#' } view_static <- function(x, plot_id = rand_id("plot_"), dest = NULL) { diff --git a/man/print.ggvis.Rd b/man/print.ggvis.Rd index 76dcf094..1b649aa6 100644 --- a/man/print.ggvis.Rd +++ b/man/print.ggvis.Rd @@ -45,6 +45,8 @@ If \code{view_static} is used on a ggvis object that has dynamic components, it will output a static plot. } \examples{ +## Run these examples only in interactive R sessions +if (interactive()) { # In most cases view_static is unnecessary; these will do the same thing: mtcars \%>\% ggvis(~wt, ~mpg) mtcars \%>\% ggvis(~wt, ~mpg) \%>\% view_static() @@ -53,4 +55,5 @@ mtcars \%>\% ggvis(~wt, ~mpg) \%>\% view_static() outfile <- mtcars \%>\% ggvis(~wt, ~mpg) \%>\% view_static() \%>\% htmltools::html_print(viewer = NULL) } +} \keyword{internal}