#Loading Libraries I’ll need

library(tidyverse)
## -- Attaching packages ------------------------------------ tidyverse 1.2.1 --
## v ggplot2 3.2.1     v purrr   0.3.2
## v tibble  2.1.3     v dplyr   0.8.3
## v tidyr   0.8.3     v stringr 1.4.0
## v readr   1.3.1     v forcats 0.4.0
## -- Conflicts --------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(ggrepel)

#Loading the data source

source ("getRiceData.R")
data <- getRiceData()
## 
## Attaching package: 'lubridate'
## The following object is masked from 'package:base':
## 
##     date

##Select the Five Day Period

Feb_data <- slice( data, 4994:5473 )

##Graphs

##Depth_m

Feb_data$label <- as.character(Feb_data$Date)

Feb_data %>% 
  arrange(desc(Depth_m)) -> high5

high5 <- high5[1:5,]

Feb_data$meanDepth <- Feb_data$Depth_m > mean(Feb_data$Depth_m)

Feb_data %>%
  ggplot( aes(x=Date, y=Depth_m, color=meanDepth) ) + geom_point( alpha=.35 ) +
  geom_label_repel(aes(label = label), color = "black", data=high5)

##Chla_ugl

Feb_data %>% 
  arrange(desc(Chla_ugl)) -> top52

top52 <- top52[1:5,]

Feb_data$Abovemean <- Feb_data$Chla_ugl > mean(Feb_data$Chla_ugl)

Feb_data %>%
  ggplot( aes(x=Date, y=Chla_ugl, color = Abovemean) ) + 
  geom_point( alpha=.35 , size=4) + 
  geom_label_repel(aes(label = label), color = "black", data=top52) +
  xlab("Date") + ylab("Chlorphyll A (micrograms per liter)")

summary(Feb_data)
##     RecordID          PAR            WindSpeed_mph       WindDir       
##  Min.   :48809   Min.   :   0.0000   Min.   : 0.736   Min.   :  1.964  
##  1st Qu.:48929   1st Qu.:   0.0000   1st Qu.: 2.205   1st Qu.: 26.968  
##  Median :49049   Median :   0.1225   Median : 3.239   Median : 54.285  
##  Mean   :49049   Mean   : 303.9946   Mean   : 4.032   Mean   :118.664  
##  3rd Qu.:49168   3rd Qu.: 508.9750   3rd Qu.: 5.034   3rd Qu.:231.800  
##  Max.   :49288   Max.   :1591.0000   Max.   :13.960   Max.   :359.300  
##   RelHumidity        BP_HG         H2O_TempC       SpCond_mScm    
##  Min.   :16.36   Min.   :29.78   Min.   : 5.850   Min.   :0.1150  
##  1st Qu.:41.92   1st Qu.:29.91   1st Qu.: 7.487   1st Qu.:0.1650  
##  Median :52.20   Median :29.98   Median : 8.605   Median :0.1680  
##  Mean   :53.41   Mean   :29.98   Mean   : 8.308   Mean   :0.1686  
##  3rd Qu.:67.24   3rd Qu.:30.05   3rd Qu.: 9.180   3rd Qu.:0.1730  
##  Max.   :86.70   Max.   :30.15   Max.   :10.150   Max.   :0.1920  
##   Salinity_ppt          PH        Turbidity_ntu     Chla_ugl    
##  Min.   :0.0500   Min.   :6.600   Min.   :17.8   Min.   :3.000  
##  1st Qu.:0.0800   1st Qu.:7.540   1st Qu.:22.5   1st Qu.:3.700  
##  Median :0.0800   Median :7.570   Median :25.2   Median :4.000  
##  Mean   :0.0796   Mean   :7.563   Mean   :25.6   Mean   :3.984  
##  3rd Qu.:0.0800   3rd Qu.:7.610   3rd Qu.:28.0   3rd Qu.:4.200  
##  Max.   :0.0900   Max.   :7.670   Max.   :45.2   Max.   :5.600  
##    BGAPC_CML         ODO_sat         ODO_mgl         Depth_m     
##  Min.   : 442.0   Min.   : 88.6   Min.   :10.47   Min.   :4.176  
##  1st Qu.: 907.8   1st Qu.:100.1   1st Qu.:11.90   1st Qu.:4.414  
##  Median :1033.0   Median :102.1   Median :11.97   Median :4.660  
##  Mean   :1043.9   Mean   :101.7   Mean   :11.95   Mean   :4.653  
##  3rd Qu.:1166.2   3rd Qu.:103.8   3rd Qu.:12.03   3rd Qu.:4.868  
##  Max.   :1872.0   Max.   :106.7   Max.   :12.38   Max.   :5.138  
##       Date                        Airtemp            Rain  
##  Min.   :2014-02-22 00:15:00   Min.   :-2.506   Min.   :0  
##  1st Qu.:2014-02-23 06:11:15   1st Qu.: 2.092   1st Qu.:0  
##  Median :2014-02-24 12:07:30   Median : 5.544   Median :0  
##  Mean   :2014-02-24 12:07:30   Mean   : 6.541   Mean   :0  
##  3rd Qu.:2014-02-25 18:03:45   3rd Qu.:10.828   3rd Qu.:0  
##  Max.   :2014-02-27 00:00:00   Max.   :18.056   Max.   :0  
##    WindSpeed         label           meanDepth       Abovemean      
##  Min.   : 1.184   Length:480         Mode :logical   Mode :logical  
##  1st Qu.: 3.549   Class :character   FALSE:236       FALSE:228      
##  Median : 5.212   Mode  :character   TRUE :244       TRUE :252      
##  Mean   : 6.489                                                     
##  3rd Qu.: 8.101                                                     
##  Max.   :22.466