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 8088bdc commit 39337c2Copy full SHA for 39337c2
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
@@ -362,13 +362,18 @@ test_that("group_by() on a plotly object doesn't produce warning", {
362
test_that("Check QTables dont cause errors", {
363
.createQTableArray <- function(n, class.name)
364
structure(
365
- array(runif(n), dim = c(n, 1L)),
+ array(runif(n), dim = n),
366
class = class.name
367
)
368
s <- data.frame(
369
x = .createQTableArray(10, "QTable"),
370
- y = .createQTableArray(10, "qTable")
+ x2 = .createQTableArray(10, "qTable"),
371
+ y = factor(letters[1:10])
372
- expect_error(p <- plot_ly(s, x = ~x, y = ~y), NA)
373
+ expect_error(p <- plot_ly(s) |>
374
+ add_segments(x = ~x, xend = ~x2, y = ~y, yend = ~y, showlegend = FALSE) |>
375
+ add_markers(x = ~x, xend = ~y, y = ~y, name = "foo", color = I("orange"), showlegend = FALSE) |>
376
+ add_markers(x = ~x2, xend = ~y, y = ~y, name = "bar", color = I("blue"), showlegend = FALSE),
377
+ NA)
378
expect_error(print(p), NA)
379
})
0 commit comments