8.3 Embed a Web Page

The R Markdown knitr package has an existing function include_url to call the HTML iframe. So, we can simply use it to embed a web page.

  1. Insert an r chunk and add the function knitr::include_url( ) in the r code chunk.
```{r out.width='100%'} 
knitr::include_url('https://www.desmos.com/calculator', height='600px')
```
  1. Adjust the width and height of the web page window.
  • out.width=‘100%’ means the web page window is as wide as the page content.
  • height=‘600px’ means the height of the web page is 600 pixels.

Caution: When using web page, it is better to login your web page account (e.g., Desmos). Otherwise, you lose your work when you reload the page.

Now you should see the Desmos calculator web page in here.

If the content of the web page needs resizing, we will have to work directly with the iframe like we did in the previous section. Here is the awesome Slope Field app for ordinary differential equations, designed by Professor Darryl Nester from Bluffton University. The content has been rescaled to fix this page. See implimentation in Appendix B.1.