Trouble when adding a map to an RHTML document

I am creating an R HTML document and i got this error when I am trying to add a map :

In file(con, "rb") :
  cannot open file 'C:\Users\martin\AppData\Local\Temp\RtmpYX9GLA\file4e1423052956\webshot4e142eae6709.png' : No such file or directory

This is my R code :

<html>

<head>
<title>Title</title>
</head>

<body>

<p>This is my HTML document</p>

<!--begin.rcode
summary(cars)
end.rcode-->

<p>You can also embed plots, for example:</p>


<!--begin.rcode zonier, echo = FALSE, message = FALSE, warning = FALSE
library(rjson)
library(plotly)

url <- 'https://raw.githubusercontent.com/plotly/datasets/master/geojson-counties-fips.json'
counties <- rjson::fromJSON(file=url)
url2<- "https://raw.githubusercontent.com/plotly/datasets/master/fips-unemp-16.csv"
df <- read.csv(url2, colClasses=c(fips="character"))
fig <- plot_ly() 
fig <- fig %>% add_trace(
  type="choroplethmapbox",
  geojson=counties,
  locations=df$fips,
  z=df$unemp,
  colorscale="Viridis",
  zmin=0,
  zmax=12,
  marker=list(line=list(
    width=0),
    opacity=0.5
  )
)
fig <- fig %>% layout(
  mapbox=list(
    style="carto-positron",
    zoom =2,
    center=list(lon= -95.71, lat=37.09))
)
fig

end.rcode-->

</body>
</html>

I tried to add another type of map but I still got the same error.

How can we fix it ? Some help would be appreciated

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.