Introduction to the App InsectSprays

Yan Feng
July 9th, 2017

Outlines

  • InsectSprays dataset is an R built-in data set. It measures the number of insects after being sprayed with 6 different insecticides.
  • The InsectSprays App allows you to select any number of sprays, and make boxplots to demonstrate their effects.
  • The App also allows you to select any 2 sprays, and carry out the t test to give the p-value. It can conclude whether these 2 selected sprays are significantly different.

Subset the data and make boxplot

IS.subset = subset(InsectSprays, InsectSprays$spray == c("B", "C", "D"))
library(ggplot2)
ggplot(IS.subset, aes(x = spray, y = count)) + geom_boxplot(aes(color = spray))

Boxplot

plot of chunk unnamed-chunk-1

t.test and p value

After t-test of spray B and spray C, the p value is

[1] 5.170528e-08

Conclusion: B and C are significantly different.