plotly / plotly/plotly.R

Plotly generates many warnings because of trying to set `structure(NULL)`

Open
#1,299 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

This line in plotly:
https://github.com/ropensci/plotly/blob/a76100d7c06774ec50c07982ff6bfdb6d2d09e2d/R/plotly_build.R#L281-L284

can result in setting structure(NULL), which throws many warnings.

I have an app with many plots, and one plot generates dozens of copies of this warning:

Warning in structure(if (i %in% npscales()) uniq(d[[i]]) else d[[i]], class = oldClass(x[[i]])) : Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes. Consider 'structure(list(), *)' instead.

I don't have a minimal reprex because I haven't spent too much time finding out what kind of data can cause a NULL there, but it's definitely a NULL in d[[i]] that causes these warnings.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in R/plotly_build.R at lines 281-284 and trace how a NULL value in d[[i]] reaches structure(). Reproduce the warning with a plot containing the relevant data shape, then verify that plotly no longer emits the repeated deprecation warnings while preserving the existing plot-building behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.