I keep getting [WARNING] Deprecated: --self-contained. use --embed-resources --standalone
when saving a plotly plot as a self-contained html widget, using htmlwidgets::saveWidget(..., selfcontained = TRUE)
.
I can't figure out how to use "embed-resources" or "standalone" as arguments in the function. This just recently started, wondering if anyone else has had this warning occur, or knows the proper arguments to use for this. Updated RStudio and the package, but the warning persists.
Using R 4.2.1, RStudio 2022.07.2+576 "Spotted Wakerobin", htmlwidgets
1.5.4.
library(plotly)
library(htmlwidgets)
fig <- plot_ly(x = 1:10, y = 1:10, type = "scatter", mode = "lines")
htmlwidgets::saveWidget(partial_bundle(fig), file = "plotly.html", selfcontained = TRUE)
utils::browseURL("plotly.html")
That's a Pandoc change in version 2.19. You can see what version you're using with htmlwidgets:::pandoc_available(); htmlwidgets:::.pandoc$version
. I think RStudio distributes version 2.18, but they may have updated, or you may have installed it separately.
The Pandoc change log is here: https://pandoc.org/releases.html .
I don't think there's any way to fix that other than editing the htmlwidgets
source. Maybe this will be fixed in the next release?
EDITED to add: This change has been handled in rmarkdown
for a while, but htmlwidgets
was calling Pandoc directly. The next release (1.6.0) of htmlwidgets
will fix it by letting rmarkdown
handle the call. This should also future-proof it a bit.