Turn in one copy of the R Script for each group. If group members are not present in class they will be required to complete their own lab to receive credit.

Lab Overview

The entire lab will be worth 100 points.


Answer the following questions in this R Markdown document. Please include code where necessary.

1. R Shiny with ggplot2

Please modify the default R Shiny applet to include a ggplot2() histogram.

2. R Shiny Options

Next, modify the default R Shiny code to create a histogram based on the central limit theorem to create an R Shiny applet. Shiny should allow you to update the slider to permit between 5 and 100 observations.

CLT.hist <- function(num.obs){
  ## Function to create a histogram to depict central limit theorem
  ## data generated from Exponential distribution
  ## ARGS: num.obs - number of observations from Exponential(1)
  num.sims <- 10000
  sample.means <- rowMeans(matrix(rexp(num.sims*num.obs),nrow = num.sims, ncol = num.obs))
  hist(sample.means,prob=T, xlab='', breaks=seq(0,8,by=.2))