
---
title: "Lec 21: In-class Exercise: Iteration"
output:
  html_document
---

```{r, include=FALSE}
# Do not edit this code chunk
knitr::opts_chunk$set(echo = TRUE, message=FALSE, warning = FALSE)
```

```{r}
library(tidyverse)
```

# Ex1: `across()`

```{r}
# create a data frame
df <- data.frame(
  name = c("obs1", "obs2", "obs3", "obs4"),
  a = c(2, 3, 4, 5),
  b = c(4, 7, 2, 1),
  c = c(4, 9, 3, 2)
)
```

```{r}
# summarize three numeric columns

```

```{r}
# group by name and summarize three numeric columns

```

# Ex2: `purrr` package `map()` function

## Ex2-1

```{r}
# summarize three numeric columns, `map()` creates a list

```

## Ex2-2

```{r}
# `map_dfc()` creates a tibble, (c for columns) stacks them side-by-side

```

## Ex2-3

```{r}
# `map_dfr()` creates a tibble, (r for rows) stacks the smaller tibbles on top of each other

```

## Getting Creative

## Ex 3-1 Use  across() on the `penguins` data from the palmerpenguins package to do something. 


## Ex 3-2 Use map() on the `penguins` data from the palmerpenguins package to do something. 
