ERROR: Unexported object imported by a `:::` call: `plotly:::getLevels` See the note in `?`:::` about the use of this operator

Hi! I'm creating a shiny app as a package using { golem } and one of my plots has an animation feature using plotly:::getLevels and when I check my package I get this warning:

Unexported object imported by a `:::` call: `plotly:::getLevels` 
  See the note in `?`:::` about the use of this operator

I am a total package newby but I think this is because using ::: in a package is a no-no, anyone have advice for how to get around this?

That ::: is telling you that getLevels is an unexported/internal function. If you see the use of this and want access to that function, the two standard solutions are,

  1. Contact the package author and ask them to export the function. (which might make sense for complicated functions)
  2. Copy the function, and cite original author as needed.

That all being said in this case just take option 2. getLevels is a very simple function that gets the factor levels of a factor vector. (Some background on factors in R)

Add this function, replace all plotly:::getLevels with getLevels, and you're off to the races!

getLevels <- function (x) {
    if (is.factor(x)) 
        levels(x)
    else sort(unique(x))
}
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.