8.4 Embed a Web App
- Insert an r chunk.
```{r}
```
- Add the function knitr::include_app( ) in the r code chunk.
```{r out.width='100%'}
knitr::include_app('https://3.19.223.22:3838/sta126-test/', height='600px')
```
- 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.
Here is an example of a R Shiny app. Once the last four digits of a student’s Mercer University ID is typed in, the app generates randomized datasets for each student on an introductory statistics test. Students can use the tabs to preview the datasets for the two questions and use the download buttons to save the datasets as csv files. It is also coded in a way that half the students do confidence intervals on Question 7 and hypothesis tests on Question 8, while the other half do hypothesis tests on Question 7 and confidence intervals on Question 8. The codes for the app are explained in the appendix.