###################################################################
############### Module 6, Basics of data wrangling ################
###################################################################
## (Bonus) Lesson 14, Part 1: Dealing with dates (parsing and date math)

# Load the tidyverse packages:
library(tidyverse)

###################################
##### LOAD THE DATA
# For this lesson we will use data on the date of first flowering of 
# plants in the Northern Great Plains of North America:
# Steven E. Travers and Kelsey L. Dunnell. 2009. First-flowering dates of plants in the Northern Great Plains. Ecology 90:2332.
# http://www.esapubs.org/archive/ecol/E090/162/default.htm#data
# The data are available between the years of 1910 and 1961 and essentially
# consist of the date each year when each species first flowered after the winter.

ff_data_raw <- read_csv("data/first_flower_data.csv")


###################################
##### PREPARE THE DATA




###################################
##### PARSING DATES AND DATE MATH

# To get a bunch of functions that will help us work with dates
# more easily, install and load the "lubridate" package
# install.packages("lubridate")
library("lubridate")




###################################
##### SUMMARY
# - Reviewed some data cleaning procedures and pivot_longer
# - Parsing dates
# - Date math
# - Summarizing dates

