knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(fcess) library(tidyverse)
# View initial data head(fce_bullshark)
# Detach Year, Month, and Day from the Date variable fce_bullshark <- fce_bullshark %>% mutate(Year = format(Date, "%Y"), Month = format(Date, "%m"), Day = format(Date, "%d")) fce_bullshark
# Group the counts of Bull Sharks by Year counts <- fce_bullshark %>% group_by(Year) %>% summarise(bycount = sum(Bull_Shark_Count))
# Plot Bull Shark Count Overtime ggplot(data = counts, aes(x = Year, y = bycount, fill = bycount)) + geom_bar(stat = "identity") + labs(x = "Year", y = "Number of Bull Sharks", title = "Bull Shark Counts Overtime") + geom_text(aes(label = bycount)) + theme(plot.title = element_text(hjust = 0.5))
# Group the counts of Bull Sharks by Sitename sitecounts <- fce_bullshark %>% group_by(SITENAME, Year) %>% summarise(bycount = sum(Bull_Shark_Count), temp = mean(Temperature)) sitecounts
# Plot the site Bullshark counts from 2005 to 2009 ggplot(data = sitecounts, aes(x = Year, y = bycount, group = SITENAME, color = SITENAME)) + geom_line() + labs(x = "Year", y = "Bull Shark Count", title = "Bull Shark Counts by Site") + theme(plot.title = element_text(hjust = 0.5))
ggplot(data = fce_bullshark, aes(x = Date, y = Temperature)) + geom_line() + labs(x = "Date", y = "Temperature", title = "Temperature Overtime") + theme(plot.title = element_text(hjust = 0.5))
# Plot the site Bullshark counts from 2005 to 2009 ggplot(data = sitecounts, aes(x = Year, y = temp, group = SITENAME, color = SITENAME)) + geom_line() + labs(x = "Year", y = "Temperature (CÂș)", title = "Yearly Mean Temperatures by Site") + theme(plot.title = element_text(hjust = 0.5))
# boxplot by salinity by site ggplot(data = fce_bullshark, aes(x = reorder(SITENAME, Salinity, FUN = median), y = Salinity, color =SITENAME)) + geom_boxplot() + labs(x = "Site Name", y = "Salinity", title = "Salinity by Site") + theme(plot.title = element_text(hjust = 0.5))
ggplot(data = fce_bullshark, aes(x = Date, y = Salinity)) + geom_line() + labs(x = "Date", y = "Salinity", title = "Salinity Overtime") + theme(plot.title = element_text(hjust = 0.5))
year06 <- as.tibble(fce_bullshark) year06 <- filter(fce_bullshark, Date >= as.Date("2006-01-01"), Date <= as.Date("2006-12-31"))
ggplot(data = year06, aes(x = Date, y = Bull_Shark_Count)) + geom_bar(stat = "identity", fill = "dodgerblue") + labs(title = "Total Bull Shark Count", x = "Date", y = "Number of Bull Sharks") + theme(plot.title = element_text(hjust = 0.5))
year09 <- as.tibble(fce_bullshark) year09 <- filter(fce_bullshark, Date >= as.Date("2009-01-01"), Date <= as.Date("2009-12-31"))
ggplot(data = year09, aes(x = Date, y = Bull_Shark_Count)) + geom_bar(stat = "identity", fill = "dodgerblue") + labs(title = "Total Bull Shark Count", x = "Date", y = "Number of Bull Sharks") + theme(plot.title = element_text(hjust = 0.5))
Heithaus, M. and P. Matich. 2014. Bull shark catches, water temperatures, salinities, and dissolved oxygen levels in the Shark River Slough, Everglades National Park (FCE) , from May 2005 to May 2009 ver 3. Environmental Data Initiative. https://doi.org/10.6073/pasta/04a8792fed9ceed4237bd3273a97e8f8 (Accessed 2021-04-19).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.