Fix. Account for the "data_array" property of the "values" attribute of the "dimensions" attribute. Closes #2385
This PR proposes a fix to account for the "data_array" property of the "values" attribute of the "dimensions" attribute used in special traces like "parcoords", "parcats" and "splom" traces thereby closing #2385.
Currently, when an attribute has the "data_array" attribute it gets wrapped in AsIs inside verify_attr. However, this check gets skipped for the dimensions attribute as it is an unnamed list. Additionally, the schema specs for the values attribute are somewhat nested.
To account for that the PR adds some special treatment for dimensions attribute to verify_attr which uses lapply to loop over the items of the dimensions list.
With the proposed fix the examples documented in #2385 work fine, e.g. for "parcats":
library(plotly, warn=FALSE)
#> Loading required package: ggplot2
dd <- data.frame(
from = "A",
to = "B"
)
plot_ly(dd) %>%
add_trace(
type = "parcats",
dimensions = list(
list(values = ~from),
list(values = ~to)
)
)

Created on 2024-08-31 with reprex v2.1.1