---
title: "Data I/O Lab, Part 1"
output: html_document
---

```{r, include = TRUE}
library(readr)
library(readxl)
```

This lab uses different versions of the `iris` dataset. You can use links or download them to your machine. Copy the code produced by the dropdown menu into the code chunk.

You can see more about this dataset by running `?iris` in the console.

1. Read in the `https://sisbid.github.io/Data-Wrangling/data/iris/iris_q1.csv` dataset into the `iris_q1` R object. What delimiter separates columns?

```{r}
iris_q1 <- read_csv("https://sisbid.github.io/Data-Wrangling/data/iris/iris_q1.csv") # Your directory may vary!
head(iris_q1)
```

2. Read in the `https://sisbid.github.io/Data-Wrangling/data/iris/iris_q2.tsv` dataset into the `iris_q2` R object. What delimiter separates columns?

```{r}
iris_q2 <- read_delim("https://sisbid.github.io/Data-Wrangling/data/iris/iris_q2.tsv", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)
head(iris_q2)
```

3. Read in the `https://sisbid.github.io/Data-Wrangling/data/iris/iris_q3.txt` dataset into the `iris_q3` R object. What delimiter separates columns?

```{r}
iris_q3 <- read_table("https://sisbid.github.io/Data-Wrangling/data/iris/iris_q3.txt")
head(iris_q3)
```

4. Read in the `https://sisbid.github.io/Data-Wrangling/data/iris/iris_q4.csv` dataset into the `iris_q4` R object. What delimiter separates columns? [hint: file extension is ambiguous]

```{r}
iris_q4 <- read_delim("https://sisbid.github.io/Data-Wrangling/data/iris/iris_q4.csv", 
    delim = ":", escape_double = FALSE, trim_ws = TRUE)
head(iris_q4)
```

5. Read in the `https://sisbid.github.io/Data-Wrangling/data/iris/iris_xl.xlsx` dataset into the `iris_xl` R object. 

```{r}
url <- "https://sisbid.github.io/Data-Wrangling/data/iris/iris_xl.xlsx"
destfile <- "iris_xl.xlsx"
curl::curl_download(url, destfile)
iris_xl <- read_excel(destfile)
head(iris_xl)
```
