Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed Youtube Video in R Markdown

I am trying to publish a .Rmd in Rpubs by embedding a YouTube video link. After some exploration, I am trying the following which just gives a blank space in my html.

<div align="center">
   <iframe width="560" height="315" src="http://www.youtube.com/embed/zsYjsgm4Psg" frameborder="0" allowfullscreen>
   </iframe>
</div>

Two related posts:

  1. rmarkdown: Alter Action Depending on Document
  2. R markdown Embedded Youtube Video
like image 837
S Das Avatar asked Dec 31 '14 00:12

S Das


People also ask

How do I add a video to R markdown?

embed_video() provides a standard way to embed video in R Markdown documents when the output format is HTML, and to print placeholder text when the output format is not HTML.

How do I embed code in R markdown?

You can insert an R code chunk either using the RStudio toolbar (the Insert button) or the keyboard shortcut Ctrl + Alt + I ( Cmd + Option + I on macOS).

Can R markdown be interactive?

R Markdown documents are a perfect platform for interactive content. To make your documents interactive, add: Interactive JavaScript visualizations based on htmlwidgets, or. Reactive components made with Shiny.

Does R markdown use Pandoc?

R Markdown (package)This function 'renders the input file to the specified output format using pandoc. If the input requires knitting then knitr::knit is called prior to pandoc. The RMarkdown package's aim is simply to provide reasonably good defaults and an R-friendly interface to customize Pandoc options..


1 Answers

<iframe width="560" height="315" src="http://www.youtube.com/embed/9bZkp7q19f0?rel=0" frameborder="0" allowfullscreen></iframe>

This can optionally be put inside a code chunk within your .Rmd

Source

like image 127
Hack-R Avatar answered Sep 24 '22 08:09

Hack-R