In R, the function include_url()
from the knitr package allows to set the height, but not the width of an embedded iframe.
knitr::include_url("https://www.youtube.com/embed/9bZkp7q19f0", height="315")
The above will embedd the youtube with height =315 and width=672. Is there a way to set the width myself?
Edit the width attribute. You should see the attribute "width=" after the URL in the iframe tag. Edit the width in pixels in quotations (" ") after the "width=" attribute. For example, if you want the width to be 300 pixels, you would enter "width="300px"" after the URL in the tag.
Use the chunk option out.width
, e.g., out.width="100%"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With