【问题标题】:R htmlwidgets with reveal.jsR htmlwidgets 与reveal.js
【发布时间】:2015-06-15 00:35:21
【问题描述】:

如何将出色的 htmlwidgets(例如 http://rstudio.github.io/leaflet/)与reveal.js 和 Rmarkdown 一起使用?

这个mwe(不是rev​​eal.js)有效:

---
title: "Maptest 1"
output: html_document
---

##  Map

```{r, echo=FALSE}
library(leaflet)
m <- leaflet()
m <- addTiles(m)
m <- addMarkers(m, lng=174.768, lat=-36.852, popup="The birthplace of R")
m
```

但是这个没有:

---
title: "Maptest 2"
output: revealjs::revealjs_presentation
---

##  Map

```{r, echo=FALSE}
library(leaflet)
m <- leaflet()
m <- addTiles(m)
m <- addMarkers(m, lng=174.768, lat=-36.852, popup="The birthplace of R")
m
```

我重新使用了 htmlwidgets-webpage 中的示例,reveal.js-template 来自https://github.com/jjallaire/revealjs

【问题讨论】:

    标签: r knitr r-markdown reveal.js


    【解决方案1】:

    要使用reveal.js,您需要在标题中指定框架和扩展小部件。还要确保您拥有最新版本的 slidify 和 htmlwidgets。

    ---
    title       : Titley Title Titler
    subtitle    : subtitileir
    author      : Author Authoria
    job         : Jobby job, CJJ
    framework   : revealjs        # {io2012, html5slides, shower, dzslides, ...}
    highlighter : highlight.js  # {highlight.js, prettify, highlight}
    hitheme     : github      # 
    widgets     : []            # {mathjax, quiz, bootstrap}
    mode        : selfcontained # {standalone, draft}
    knit        : slidify::knit2slides
    ext_widgets: {rCharts: "libraries/highcharts"}
    revealjs:
      theme: Simple
    --- 
    
    ### Title-y Title Titler
    
    
     Tu-title space title
     \- Author Authorio
    
    --- 
    

    【讨论】:

    • 所以我假设您需要用比 rCharts 更具体的东西替换 extwidgets 行?
    • 实际上我发现我的错误在我的代码中的其他地方,而且我根本不需要包含上述内容来获得我需要的功能。道歉。
    猜你喜欢
    • 2017-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-15
    • 2016-12-25
    相关资源
    最近更新 更多