---
title: "Exercise 4.1"
author: "Put Your Name Here"
output:
  html_document:
    toc: true
---

<!-- You can knit this document at any time to see the draft of your answer. 
     An html file will be produced in the same folder as the Rmd file. -->

<!-- When you have completed the exercise, knit the document for the final time. -->

```{r setup, include = FALSE}
knitr::opts_chunk$set(
  echo = TRUE,
  comment = NA,
  fig.width = 7,
  fig.height = 4,
  dpi = 130
)
```

In this exercise, we will be using functions from the `tidyverse` package.
You can see we've added the chunk option `message = FALSE` to hide the version
information that `tidyverse` normally displays.

```{r packages, message = FALSE}
library(tidyverse)
library(gt)
```

### (a) Make a summary table using gt

> We've provided some code to summarise the icecore data seen in previous
> exercises. Modify this to present the resulting data frame as a nice table,
> using the `gt()` function.
>
> Think about appropriate headings, column names, decimal places.

```{r, message = FALSE}
icecore <- read_csv("icecore.csv")
```

```{r}
icecore %>%
  group_by(core) %>%
  summarise(n_samples = n(),
            earliest_year_AD = min(air_age_AD),
            latest_year_AD = max(air_age_AD),
            min_depth_m = min(depth_m),
            max_depth_m = max(depth_m),
            mean_CO2_ppm = mean(CO2_ppm),
            sd_CO2_ppm = sd(CO2_ppm)) %>%
  ungroup()
```



---

&copy; 2021 Statistical Consulting Centre, The University of Melbourne.
