YouTube video at R markdown

Can I embed a YouTube video in R Markdown? So far i have

<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> 

but only adds an image. Clicking on this image takes me to my browser, where the video starts playing. Is there a way that allows me to play the video in the markdown document itself?

References: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#videos

+6
source share
2 answers

You will need to use an iframe. For example, adding a video with a mark to the main RMD template:

 --- 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. 

Please note that the video will not be displayed in the preview window, but will be displayed in a browser connected to the Internet.

+7
source

The answer may be as simple as I think:

 ![](https://youtu.be/zNzZ1PfUDNk) 
-2
source

All Articles