htmlwidgets::saveWidget() 中已弃用参数“selfcontained”

bt3*_*bt3 10 html r plotly htmlwidgets

当我[WARNING] Deprecated: --self-contained. use --embed-resources --standalone使用htmlwidgets::saveWidget(..., selfcontained = TRUE).

我不知道如何使用“嵌入资源”或“独立”作为函数中的参数。这只是最近开始的,想知道是否有其他人发生过此警告,或者知道为此使用的正确参数。更新了 RStudio 和软件包,但警告仍然存在。

使用 R 4.2.1、RStudio 2022.07.2+576“斑点 Wakerobin”、htmlwidgets1.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")
Run Code Online (Sandbox Code Playgroud)

use*_*330 5

这是 2.19 版本中的 Pandoc 更改。您可以查看您正在使用的版本htmlwidgets:::pandoc_available(); htmlwidgets:::.pandoc$version。我认为 RStudio 分发了 2.18 版本,但他们可能已经更新,或者您可能已经单独安装了它。

Pandoc 变更日志位于: https: //pandoc.org/releases.html

我认为除了编辑源代码之外没有任何方法可以解决这个问题htmlwidgets。也许这会在下一个版本中修复?

编辑添加:此更改已处理rmarkdown一段时间,但htmlwidgets直接调用 Pandoc。的下一个版本(1.6.0)将通过处理调用htmlwidgets来修复它。rmarkdown这也应该是面向未来的。