Import your data

# excel file
data <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2019/2019-06-25/ufo_sightings.csv")
## Rows: 80332 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (8): date_time, city_area, state, country, ufo_shape, described_encounte...
## dbl (3): encounter_length, latitude, longitude
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Chapter 15

Create a factor

x <- c("state", "country", "ufo_shape")
x
## [1] "state"     "country"   "ufo_shape"
sort(x)
## [1] "country"   "state"     "ufo_shape"

Modify factor order

Make two bar charts here - one before ordering another after

Modify factor levels

Show examples of three functions:

data %>%
    distinct(state)
## # A tibble: 68 × 1
##    state
##    <chr>
##  1 tx   
##  2 <NA> 
##  3 hi   
##  4 tn   
##  5 ct   
##  6 al   
##  7 fl   
##  8 ca   
##  9 nc   
## 10 ny   
## # ℹ 58 more rows

Chapter 16

No need to do anything here.