【发布时间】:2018-02-08 16:56:15
【问题描述】:
我正在尝试将一些交互式图形保存到额外的文件中。这适用于htmlwidget::saveWidget。但是我将它们保存到不同的文件夹(例如结果文件夹)时会遇到问题。
results_dir <- 'results'
if(!dir.exists(results_dir)) dir.create(results_dir)
p <- plotly::plot_ly(economics, x = ~date, y = ~pop,
type = 'scatter', mode = 'markers')
htmlwidgets::saveWidget(p,
file.path(results_dir, 'VSGs.html'))
错误信息是:
normalizePath 中的错误(基本路径,“/”,TRUE):
path[1]="results": 没有这样的文件或目录
有人知道发生了什么吗?
我知道之后只是移动文件,但我希望解决此错误消息。
htmlwidgets::saveWidget(p, 'VSGs.html')
file.rename('VSGs.html', file.path(results_dir, 'VSGs.html'))
【问题讨论】:
标签: r plotly htmlwidgets