Skip to content

group_by() seems to crash interactivity when used with plotly and crosstalk #5726

@fjodor

Description

@fjodor

Since updating dplyr, a plotly chart linked with a slider and a checkbox via crosstalk does not react to the controls any more. The following code works with dplyr version 1.0.2. In versions 1.0.3 and 1.0.4 I need to comment out the group_by() statement to make it work.

(In my use case, group_by() is more useful than in this minimal example. A flexdashboard created on January 13 worked fine. Knitting the same unchanged code now gives me the same plots, no errors or warnings, and no interactivity. My temporary solution is to use renv and stick with dplyr 1.0.2 for that project.)

library(plotly)
library(crosstalk)

shared_data <- mtcars %>% 
  SharedData$new()

p <- shared_data %>% 
  plot_ly(x = ~mpg, y = ~hp) %>%
  group_by(am) %>%
  add_markers()

bscols(list(
  filter_slider(id = "mpg", label = "Miles per Gallon",
                sharedData = shared_data, column = "mpg"),
  filter_checkbox(id = "am", label = "Automatic / Manual",
                  sharedData = shared_data, group = ~am)),
  p)

# Works with dplyr 1.0.2
# Works with dplyr 1.0.3 and 1.0.4 only if group_by() is commented out

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions