YouTube Video in R markdown

后端 未结 2 1911
野的像风
野的像风 2021-02-19 04:53

Is it possible to embed a YouTube video in a R Markdown? So far what I have is



        
2条回答
  •  后悔当初
    2021-02-19 05:06

    You will need to use iframe. For example adding a markdown video to the basic 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 .
    
    
    
    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.
    

    Note that the video will not appear in the preview window but will when viewed in a browser connected to the internet.

提交回复
热议问题