I am trying to knit an RMarkdown file to an HTML that contains code to use the mapview package. I keep getting an error and tons of research into the problem, I still can't figure it out.
Here is my code:
# Grand Rapids gage at 42.96308 and -85.67725 GRlat <- 42.96308 GRlong <- -85.67725 # Eastmanville gage at 43.02419 and -86.02644 EAlat <- 43.02419 EAlong <- -86.02644 # Let's plot them and see where they are relative to each other library(sp) gages <- c("Grand Rapids", "Eastmanville") lat <- c(GRlat, EAlat) long <- c(GRlong, EAlong) coords <- data.frame(long, lat) dat <- data.frame(gages) pts <- SpatialPointsDataFrame(coords, dat) library(sf) stations <- st_as_sf(pts) stations <- stations %>% st_set_crs(st_crs(4326)) library("mapview") library("leaflet") map <- mapview::mapview(stations) map
The map works perfectly fine when I run the code. However, when I try to knit the document, here is the error message I get:
Could not determine mime type for `C:\Users\KKEETON\AppData\Local\Temp\RtmpCoAUnm\file44c86f4228d0\stations_layer.fgb' Error: pandoc document conversion failed with error 63 Execution halted
I found a similar problem on StackOverflow where they used this code:
mapshot(map, "map.html", selfcontained=FALSE)
But I'm not sure what .html file is supposed to be there. I tried it with "map.html" and nothing happened.
Any help would be so greatly appreciated!
Thank you so much!