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

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

This lab uses different "slices" of the `ufo` dataset. You can use links or download them to your machine. Copy the code produced by the dropdown menu into the code chunk. As a reminder the steps are:

-  `>` File
-  `>` Import Dataset
-  `>` From Text (`readr`)
-  `>` paste the url
-  `>` click "Update" and "Import"

If this is review to you, explore the "Import Options" on the bottom left of the import dataset menu.

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

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

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

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

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

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

4. Read in the `https://sisbid.github.io/Data-Wrangling/data/ufo/ufo_slice_4.xlsx` dataset into the `ufo_slice_4` R object. 

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