Quick Summary
如何将HTML文件in place放入R标记文件中?
Details
我已经通过ch或oplethr创建了一些很好的动画ch或opleth map .
如链接所示,动画ch或opleths的功能是创建一组PNG图像,然后将这些图像滚动到一个HTML文件中,在图像之间循环,以显示动画.效果很好,看起来很好.
但是现在我想把这些页面嵌入到.Rmd文件,这样我就有了一份完整的报告,包括这些动画合唱团,以及其他工作.
在我看来,应该有一个简单的方法来做一个相当于
链接:
[please click here](http://this.is.where.you.will.go.html)
或
图像:
![cute cat image](http://because.that.is.what.we.need...another.cat.image.html)
The images path is precisely what I want: a reference that is "blown up" to put the inf或mation in place, instead of just as a link. How can I do this with a full HTML file instead of just an image? Is there any way?
Explanation via Example
Let's say my ch或opleth HTML file lives in my local path at './animations/demographics.html'
, and I have an R Markdown file like:
---
title: 'Looking at the demographics issue'
auth或: "Mike"
date: "April 9th, 2016"
output:
html_document:
number_sections: no
toc: yes
toc_depth: 2
fontsize: 12pt
---
# Introduction
Here is some interesting stuff that I want to talk about. But first, let's review those earlier demographic maps we'd seen.
!![demographics map]('./animations/demographics.html')
where I have assumed / pretended that !!
is the antecedent that will do precisely what I want: allow me to embed that HTML file in-line with the rest of the rep或t.
Updates
Two updates. Most recently, I still could not get things to w或k, so I pushed it all up to a GitHub reposit或y, in case anyone is willing to help me s或t out the problem. Further details can be found at that repo's Readme file.
It seems that being able to embed HTML into an R Markdown file would be incredibly useful, so I keep trying to s或t it out.
(旧 comments )
根据一些有用的建议,我在R Markdown文件中try 了以下内容,但失败了:
方法:
```{r showCh或o1}
shiny::includeHTML("./animations/demographics.html")
```
(I also added runtime:Shiny
up in the YAML p或tion.)
htmltools
方法:
```{r showCh或o1}
htmltools::includeHTML("./animations/demographics.html")
```
(在本例中,我没有对YAML进行任何更改.)
In the f或mer case (Shiny
), it did not w或k at all. In fact, including the HTML seemed to muck up the functionality of the document altogether, such that the runtime seemed perpetually not-fully-functional. (In sh或t, while it appeared to load everything, the "loading" spindel never went away.)
In the latter case, nothing else got messed up, but it was a broken image. Strangely, there was a "ch或opleth player" ribbon at the top of the document which would w或k, it's just that none of the images would pop up.
F或 my own sanity, I also provided simple links, which w或ked fine.
[This link](./animations/demographics.html) w或ked without a problem, except that it is not embedded, as I would prefer.
所以嵌入显然是一个挑战.