---
title: "Activity 2"
author: "Jonathan W. Duggins" 
date: "August 9, 2023"
output:
  html_document:
    toc: true
    toc_float: true
    code_folding: hide
---

<!-- make the default option to echo the code and cache the results -->

```{r setup, include=FALSE}
r = getOption("repos")
r["CRAN"] = "http://cran.us.r-project.org"
options(repos = r)
install.packages("DT")
knitr::opts_chunk$set(echo = TRUE, cache = TRUE)
library(DT)
```

<!-- Notice these headers created a table of contents in my document! -->
# Analysis of the `ToothGrowth` Data Set

## Simple Investigation

<!-- make sure to compute the number of records dynamically, don't just look
     it up and hard code it! -->
The `ToothGrowth` data set, which contains information on the tooth growth of guinea pigs after receiving Vitamin C either through a pill (`Treatment = VC`) or orange juice (`Treatment = OJ`), has `r nrow(ToothGrowth)` records. 

An explorable table of the data is shown next.

```{r, echo = TRUE}
library(DT)
datatable(ToothGrowth)
```

## Simple Statistics of `len`

The tooth growth is recorded in the variable `len`. Its **mean** and **standard deviation** are shown below, followed by the _five number summary_.

Recall, the mean is simply $\bar{x} = (\sum_i x_i)/n$ while the formula for standard deviation is shown below. \[s = \sqrt{\sum_{i=1}^n \frac{\left(x_i - \bar{x}\right)^2}{n-1}}\]

```{r, echo = TRUE}
mean(ToothGrowth$len)
sqrt(var(ToothGrowth$len))
fivenum(ToothGrowth$len)
```

## About the Author

Include a picture you happen to have laying around, just for some practice. Bonus points if it's cute and/or adorable!

Jonathan W. Duggins has a newfound obsession with quokkas.

```{r, out.width = "400px", echo = FALSE}
knitr::include_graphics("img/quokka.jfif")
```