I'm trying to plot spatial data on interactive maps using "mapview" and "purrr". The maps are visible when using Rstudio in the .rmd but not when knitting the html. This way of presenting data in rmd is supported by "ggplot2", so I thought exporting maps in html would be useful.
Sample data:
library(mapview)
library(dplyr)
library(purrr)
df <- data.frame(lon = 1:9,
lat = 1:9,
id = c(rep(1,5), rep(2,4))) %>%
st_as_sf(coords = c("lon", "lat"), crs = 4326)
# split dataframe in multiple datasets (to produce multiple plots for each group of data)
df <- split(df, df$id)
When trying to plot in html with "purrr" and "mapview":
df %>% map(mapview)
The output in html: