I\'ve created a R markdown report where the sections and tabsets are dynamically created.
I have an issue where the Leaflet maps are not being generated in the output
This is a similar problem as described here with Highcharter
Try:
---
title: "Test Leaflet Tabs"
output: html_document
---
`r knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE, cache = F)`
```{r setup, include=FALSE}
library(leaflet)
leaflet()
```
```{r,results='asis'}
filtered_list <- 1:3
cat("## Tabs {.tabset .tabset-fade .tabset-pills}", "\n")
for (estates in filtered_list){
cat("###", estates, "\n")
cat("\n\n\n")
cat("This is where the map will go ")
# generate leaflet plot (doesn't even show white space if not stored in tagList)
page <- htmltools::tagList(
leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R")
)
cat(as.character(page))
}
```