Clo*_*ave 11 youtube video r r-markdown
是否可以在R Markdown中嵌入YouTube视频?到目前为止,我所拥有的是
<a href="http://www.youtube.com/watch?feature=player_embedded&v=Q8rakpF7duU
" target="_blank"><img src="http://img.youtube.com/vi/Q8rakpF7duU/0.jpg"
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>
Run Code Online (Sandbox Code Playgroud)
但它只添加了一个图像.单击此图像将我带到我的浏览器,视频开始播放.有没有办法允许我在降价文档中播放视频?
参考文献:https: //github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#videos
Phi*_*ker 11
您需要使用iframe.例如,将降价视频添加到基本RMD模板:
---
title: "iframe"
author: "Example"
date: "22 July 2016"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
<iframe width="560" height="315" src="https://www.youtube.com/embed/6A5EpqqDOdk" frameborder="0" allowfullscreen></iframe>
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
summary(cars)
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
Run Code Online (Sandbox Code Playgroud)
请注意,视频不会出现在预览窗口中,但会在连接到互联网的浏览器中查看.
接受的解决方案对我不起作用(2021),但这个解决方案确实有效:
<iframe src="https://www.youtube.com/embed/6A5EpqqDOdk" data-external= "1" > </iframe>
Run Code Online (Sandbox Code Playgroud)