I am creating a Report with R Markdown and a part of it is based on maps that I create with leaflet. Then I use mapshot to create a jpg and save the map. So that I can load and show the jpg in the Report.
So far this worked fine, but since my last R update (Version 4.2.0) mapshot creates an Error. And unfortunately I can hardly find any support on this error online. That's why I have created this account and this reproducible example:
library("leaflet")
library("mapview")
m <- leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R")
m
mapshot(m, file = "C:/Rplot2.jpg")
This is the error I get:
Could not load c:%5CUsers%5CVedi%5CAppData%5CLocal%5CTemp%5CRtmpqcG5qY%5Cfile36844d44770d.html
Error in (function (url = NULL, file = "webshot.png", vwidth = 992, vheight = 744, :
webshot.js returned failure value: 1
I am happy about any helpful ideas to solve this problem!