savewidget from htmlwidget in R , cannot save html file in another folder : <p>I have a map leaflet that I want to save in an html file in a specific folder.
I am using Windows 7.</p>

<p>I tried the following :</p>

<pre><code>library(htmlwidgets)
saveWidget(map_leaflet, file="ressources/test.html")

library(htmlwidgets)
saveWidget(map_leaflet, file="ressources\\test.html")

library(htmlwidgets)
path_name &lt;- file.path("ressources", "test.html", fsep="\\")
saveWidget(map_leaflet, file=path_name)

library(htmlwidgets)
path_name &lt;- paste("ressources", "test.html", sep="/")
saveWidget(map_leaflet, file=path_name)
</code></pre>

<p>As an error message, depending on the Rstudio session, I either have</p>

<p>1) Error in setwd(dir) : cannot change working directory</p>

<p>2) Cannot find path</p>

<p>When I only save like this :</p>

<pre><code>library(htmlwidgets)
saveWidget(map_leaflet, file="test.html")
</code></pre>

<p>It works perfectly.</p>

<p>Thank you in advance for your help.</p>
