###################################################################
############### Module 6, Basics of data wrangling ################
###################################################################
## Lesson 11, Part 2: The pipe operator and split-apply-combine:

# First reload the tidyverse packages and upload the island plant data:
library(tidyverse)
island_plants <- read_csv("data/island_veg_data_raw.csv")

# Also rerun our function for capitalizing species names so we can use it
# further down in the code:
cap_genus <- function(spp_name) {
  first_letter <- substr(spp_name, start=1, stop=1) #extract the first letter
  rest_of_name <- substr(spp_name, start=2, stop=nchar(spp_name)) # extract the rest
  first_let_cap <- toupper(first_letter)
  new_name <- paste(first_let_cap, rest_of_name, sep="")
  return(new_name)
}

###################################
##### PIPE OPERATOR
# A tool that will make it much easier to organize all of your
# data processing scripts.





###################################
# - pipe operator
# - split-apply-combine procedure using group_by and summarize or mutate
