我有一个 Map 传单,我想保存在特定文件夹中的html文件中 . 我使用的是Windows 7 .
我尝试了以下方法:
library(htmlwidgets)
saveWidget(map_leaflet, file="ressources/test.html")
library(htmlwidgets)
saveWidget(map_leaflet, file="ressources\\test.html")
library(htmlwidgets)
path_name <- file.path("ressources", "test.html", fsep="\\")
saveWidget(map_leaflet, file=path_name)
library(htmlwidgets)
path_name <- paste("ressources", "test.html", sep="/")
saveWidget(map_leaflet, file=path_name)
作为错误消息,取决于Rstudio会话,我要么
1)setwd(dir)出错:无法更改工作目录
2)找不到路径
当我只保存这样:
library(htmlwidgets)
saveWidget(map_leaflet, file="test.html")
它完美地运作 .
预先感谢您的帮助 .
1 回答
同意 .
这是一个解决方法:
问题似乎是saveWidget不能使用相对路径名,而normalizePath不适用于已存在的文件的路径 .
我将此称为saveWidget中的错误 .
编辑:
我已经为an existing open issue贡献了我认为更好的解决方法