We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 58ba959 commit aee4d91Copy full SHA for aee4d91
R/plotly.R
@@ -140,6 +140,7 @@ plot_ly <- function(data = data.frame(), ..., type = NULL, name,
140
if (!is.data.frame(data) && !crosstalk::is.SharedData(data)) {
141
stop("First argument, `data`, must be a data frame or shared data.", call. = FALSE)
142
}
143
+
144
if (is.data.frame(data) && nrow(data) > 0L) {
145
qtables <- vapply(data, inherits, logical(1L), c("qTable", "QTable"))
146
if (any(qtables))
tests/testthat/test-plotly.R
@@ -361,13 +361,18 @@ test_that("group_by() on a plotly object doesn't produce warning", {
361
test_that("Check QTables dont cause errors", {
362
.createQTableArray <- function(n, class.name)
363
structure(
364
- array(runif(n), dim = c(n, 1L)),
+ array(runif(n), dim = n),
365
class = class.name
366
)
367
s <- data.frame(
368
x = .createQTableArray(10, "QTable"),
369
- y = .createQTableArray(10, "qTable")
+ x2 = .createQTableArray(10, "qTable"),
370
+ y = factor(letters[1:10])
371
- expect_error(p <- plot_ly(s, x = ~x, y = ~y), NA)
372
+ expect_error(p <- plot_ly(s) |>
373
+ add_segments(x = ~x, xend = ~x2, y = ~y, yend = ~y, showlegend = FALSE) |>
374
+ add_markers(x = ~x, xend = ~y, y = ~y, name = "foo", color = I("orange"), showlegend = FALSE) |>
375
+ add_markers(x = ~x2, xend = ~y, y = ~y, name = "bar", color = I("blue"), showlegend = FALSE),
376
+ NA)
377
expect_error(print(p), NA)
378
})
0 commit comments