0

With RMarkdown it's easy to embed an interactive webmap. E.g.:

---
title: Some title 
output: 
  rmarkdown::html_document
---

```{r}
library(leaflet)

leaflet(width = "100%", height = "650px") %>%
addTiles() %>%
setView(lng = -98.33, lat = 38.37, zoom = 4)
```

This renders and appears as expected. Using org-mode:

* Some title

#+BEGIN_SRC R :session :results output (functional mode)
library(leaflet)

leaflet(width = "100%", height = "650px") %>%
  addTiles() %>%
  setView(lng = -98.33, lat = 38.37, zoom = 4)
#+END_SRC

I use C-c C-e h h to export to html, and the code appears on the resulting html page but the map does not. I've played around with :session and tried scripting mode, but I don't think this is the issue. This question addresses exporting literal html from org into html, but what's described as the solution in that question does not work if I copy/paste what's created (an html file) from running the code as an R script.

I suspect that there's some knitr or pandoc magic involved with rmarkdown::render that's not (yet) present in (org-export-to-html).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.