Skip to content

Commit 5623eec

Browse files
committed
Don't run examples on a non-interactive windows environment
(This is mainly to avoid spurious CRAN NOTE on win-builder)
1 parent 9c4e40b commit 5623eec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+94
-54
lines changed

R/add.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#' @param p a plotly visualization
44
#' @param data a data frame.
55
#' @export
6-
#' @examples
6+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
77
#'
88
#' plot_ly() %>% add_data(economics) %>% add_trace(x = ~date, y = ~pce)
99
add_data <- function(p, data = NULL) {
@@ -41,7 +41,7 @@ add_data <- function(p, data = NULL) {
4141
#' @author Carson Sievert
4242
#' @export
4343
#' @rdname add_trace
44-
#' @examples
44+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
4545
#'
4646
#' # the `plot_ly()` function initiates an object, and if no trace type
4747
#' # is specified, it sets a sensible default
@@ -704,7 +704,7 @@ special_attrs <- function(trace) {
704704
# #'
705705
# #'
706706
# #' @export
707-
# #' @examples
707+
# #' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
708708
# #'
709709
# #' x <- rnorm(10)
710710
# #' plot_ly(x = ~x) %>%

R/animate.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#' @rdname animation
2929
#' @aliases animation
3030
#' @author Carson Sievert
31-
#' @examples
31+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
3232
#'
3333
#' df <- data.frame(
3434
#' x = c(1, 2, 2, 1, 1, 2),

R/api_exports.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#' @author Carson Sievert
4747
#' @references \url{https://api.plot.ly/v2}
4848
#' @seealso [signup()]
49-
#' @examples
49+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
5050
#'
5151
#' \dontrun{
5252
#'

R/dev.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#' or a number specifying the number of spaces to indent. See [jsonlite::prettify].
1010
#' @param ... other options passed onto [listviewer::jsonedit]
1111
#' @export
12-
#' @examples
12+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
1313
#'
1414
#' plotly_json(plot_ly())
1515
#' plotly_json(plot_ly(), FALSE)
@@ -32,7 +32,7 @@ plotly_json <- function(p = last_plot(), jsonedit = interactive(), pretty = TRUE
3232
#' @param jsonedit use `listviewer::jsonedit` to view the JSON?
3333
#' @param ... other options passed onto `listviewer::jsonedit`
3434
#' @export
35-
#' @examples
35+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
3636
#' s <- schema()
3737
#'
3838
#' # retrieve acceptable `layout.mapbox.style` values

R/group2NA.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#' then `groupNames`, then `ordered`. As long as `groupNames`
2424
#' contains valid variable names, new rows will also be inserted to separate
2525
#' the groups.
26-
#' @examples
26+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
2727
#'
2828
#' # note the insertion of new rows with missing values
2929
#' group2NA(mtcars, "vs", "cyl")

R/helpers.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' multiple colorbars.
99
#' @author Carson Sievert
1010
#' @export
11-
#' @examples
11+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
1212
#'
1313
#' p <- plot_ly(mtcars, x = ~wt, y = ~mpg, color = ~cyl)
1414
#'
@@ -112,7 +112,7 @@ hide_guides <- function(p) {
112112
#' @param p a plotly object.
113113
#' @export
114114
#' @seealso [hide_legend()]
115-
#' @examples
115+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
116116
#'
117117
#' p <- plot_ly(mtcars, x = ~wt, y = ~cyl, color = ~cyl)
118118
#' hide_colorbar(p)
@@ -136,7 +136,7 @@ hide_colorbar <- function(p) {
136136
#' @param p a plotly object.
137137
#' @export
138138
#' @seealso [hide_colorbar()]
139-
#' @examples
139+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
140140
#'
141141
#' p <- plot_ly(mtcars, x = ~wt, y = ~cyl, color = ~factor(cyl))
142142
#' hide_legend(p)
@@ -153,7 +153,7 @@ hide_legend <- function(p) {
153153
#'
154154
#' @param p a plotly or ggplot object.
155155
#' @export
156-
#' @examples
156+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
157157
#'
158158
#' # currently no bargl trace type
159159
#' toWebGL(ggplot() + geom_bar(aes(1:10)))
@@ -197,7 +197,7 @@ plotly_empty <- function(...) {
197197
#' @author Carson Sievert
198198
#' @export
199199
#' @references <https://plotly-r.com/embedding-images.html>
200-
#' @examples
200+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
201201
#'
202202
#' # a red gradient (from ?as.raster)
203203
#' r <- as.raster(matrix(hcl(0, 80, seq(50, 80, 10)), nrow = 4, ncol = 5))

R/highlight.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
#' @author Carson Sievert
5353
#' @references \url{https://plotly-r.com/client-side-linking.html}
5454
#' @seealso [attrs_selected()]
55-
#' @examples
55+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
5656
#'
5757
#' # These examples are designed to show you how to highlight/brush a *single*
5858
#' # view. For examples of multiple linked views, see `demo(package = "plotly")`

R/kaleido.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#' * `scope`: a reference to the underlying `kaleido.scopes.plotly.PlotlyScope`
3838
#' python object. Modify this object to customize the underlying Chromium
3939
#' subprocess and/or configure other details such as URL to plotly.js, MathJax, etc.
40-
#' @examples
40+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
4141
#'
4242
#' \dontrun{
4343
#' # Save a single image

R/layout.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ layout.plotly <- function(p, ..., data = NULL) {
5252
#' \url{https://plotly.com/r/reference/#layout-xaxis-rangeslider}
5353
#' @export
5454
#' @author Carson Sievert
55-
#' @examples
55+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
5656
#'
5757
#' plot_ly(x = time(USAccDeaths), y = USAccDeaths) %>%
5858
#' add_lines() %>%
@@ -103,7 +103,7 @@ rangeslider <- function(p, start = NULL, end = NULL, ...) {
103103
#' [here](https://github.com/plotly/plotly.R/blob/master/inst/examples/rmd/MathJax/index.Rmd) for a **shiny** example).
104104
#' @author Carson Sievert
105105
#' @export
106-
#' @examples
106+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
107107
#'
108108
#' # remove the plotly logo and collaborate button from modebar
109109
#' config(plot_ly(), displaylogo = FALSE, collaborate = FALSE)

R/mathjax.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' @param x a character vector
99
#' @export
1010
#' @seealso [config]
11-
#' @examples
11+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
1212
#'
1313
#' plot_ly(x = c(1, 2, 3, 4), y = c(1, 4, 9, 16)) %>%
1414
#' layout(title = TeX("\\text{Some mathjax: }\\alpha+\\beta x")) %>%

0 commit comments

Comments
 (0)