In order to get the big RDS files, Megan shared her Dropbox folder big_csv, so on Mac in Terminal shell (or directly in Git pane, gear icon, Shell…), run this command to symbolically link the big_csv folder:
Trophic Groups
- Forage fish
- Grouper
- Grunts
- Higher Level Reef Fish
- Hogfish
- Lionfish
- Opportunists
- Parrotfish
- Rays
- Sea bass and Hamlets
- Sharks
- Small Reef Fish
- Snappers
Forage fish
| Hypoatherina harringtonensis |
reef silverside |
HYP HARR |
| Atherinomorus stipes |
hardhead silverside |
ATH STIP |
| Jenkinsia sp. |
herring species |
JEN SPE. |
| Harengula jaguana |
scaled sardine |
HAR JAGU |
| Anchoa lyolepis |
dusky anchovy |
ANC LYOL |
| Inermia vittata |
boga |
INE VITT |
| Hemiramphus brasiliensis |
ballyhoo |
HEM BRAS |
| Sardinella aurita |
spanish sardine |
SAR AURI |
| Harengula humeralis |
redear sardine |
HAR HUME |
| Chriodorus atherinoides |
hardhead halfbeak |
CHR ATHE |
forage_fk_abun_csv = "trophic_groups/abundance/forage_fk_abun.csv"
forage_dt_abun_csv = "trophic_groups/abundance/forage_dt_abun.csv"
forage_fk_den_csv = "trophic_groups/density/forage_fk_den.csv"
forage_dt_den_csv = "trophic_groups/density/forage_dt_den.csv"
forage_fk_diversity_csv= "trophic_groups/diversity/forage_fk_diversity.csv"
forage_dt_diversity_csv= "trophic_groups/diversity/forage_dt_diversity.csv"
if (!all(
file.exists(
forage_fk_abun_csv, forage_dt_abun_csv, forage_fk_den_csv, forage_dt_den_csv,
forage_fk_diversity_csv, forage_dt_diversity_csv))){
forage_fish_spp_list= c("HYP HARR", "ATH STIP", "JEN SPE.", "HAR JAGU", "ANC LYOL", "INE VITT", "HEM BRAS", "SAR AURI", "HAR HUME", "CHR ATHE")
#abundance
forage_fk_abun = getDomainAbundance(RVCdata_FK, forage_fish_spp_list, merge_protected = F)
write_csv(forage_fk_abun, "big_csv/trophic_groups/abundance/forage_fk_abun.csv")
forage_dt_abun = getDomainAbundance(RVCdata_DT, forage_fish_spp_list, merge_protected = F)
write_csv(forage_dt_abun, "big_csv/trophic_groups/abundance/forage_dt_abun.csv")
#density
forage_fk_den = getDomainDensity(RVCdata_FK, forage_fish_spp_list, merge_protected = F)
write_csv(forage_fk_den, "big_csv/trophic_groups/density/forage_fk_den.csv")
forage_dt_den = getDomainDensity(RVCdata_DT, forage_fish_spp_list, merge_protected = F)
write_csv(forage_dt_den, "big_csv/trophic_groups/density/forage_dt_den.csv")
#fk diversity metrics
forage_fk_abundance = forage_fk_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
forage_fk_diversity = forage_fk_abundance %>%
select(YEAR, protected_status, richness, shannon, simpson)
write_csv(forage_fk_diversity, "big_csv/trophic_groups/diversity/forage_fk_diversity.csv")
# dt diversity
forage_dt_abundance = forage_dt_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
forage_dt_diversity = forage_dt_abundance %>%
select(YEAR, protected_status, richness, shannon, simpson)
write_csv(forage_dt_diversity, "trophic_groups/diversity/forage_dt_diversity.csv")
}
Grouper
| Cephalopholis cruentata |
graysby |
CEP CRUE |
| Cephalopholis fulva |
coney |
CEP FULV |
| Dermatolepis inermis |
marbled grouper |
DER INER |
| Epinephelus flavolimbatus |
yellowedge grouper |
EPI FLAV |
| Epinephelus itajara |
goliath grouper |
EPI ITAJ |
| Epinephelus morio |
red grouper |
EPI MORI |
| Epinephelus niveatus |
snowy grouper |
EPI NIVE |
| Epinephelus striatus |
nassau grouper |
EPI STRI |
| grouper-sea bass species |
grouper-sea bass sp |
SRR SPE. |
| Mycteroperca acutirostris |
western comb grouper |
MYC ACUT |
| Mycteroperca bonaci |
black grouper |
MYC BONA |
| Mycteroperca interstitialis |
yellowmouth grouper |
MYC INTE |
| Mycteroperca microlepis |
gag |
MYC MICR |
| Mycteroperca phenax |
scamp |
MYC PHEN |
| Mycteroperca tigris |
tiger grouper |
MYC TIGR |
| Mycteroperca venenosa |
yellowfin grouper |
MYC VENE |
grouper_fk_abun_csv = "trophic_groups/abundance/grouper_fk_abun.csv"
grouper_dt_abun_csv = "trophic_groups/abundance/grouper_dt_abun.csv"
grouper_fk_den_csv = "trophic_groups/density/grouper_fk_den.csv"
grouper_dt_den_csv = "trophic_groups/density/grouper_dt_den.csv"
grouper_fk_diversity_csv= "trophic_groups/diversity/grouper_fk_diversity.csv"
grouper_dt_diversity_csv= "trophic_groups/diversity/grouper_dt_diversity.csv"
if(!all(file.exists(grouper_fk_abun_csv,grouper_dt_abun_csv,grouper_fk_den_csv,grouper_dt_den_csv, grouper_fk_diversity_csv,grouper_dt_diversity_csv))){
grouper_spp_list= c("CEP CRUE", "MYC BONA", "EPI MORI", "EPI STRI", "EPI ITAJ", "CEP FULV", "MYC MICR", "MYC PHEN", "MYC VENE", "MYC INTE", "MYC TIGR", "EPI FLAV", "DER INER", "SRR SPE.", "Epi nive", "Myc acut")
#abundance
grouper_fk_abun = getDomainAbundance(RVCdata_FK, grouper_spp_list, merge_protected = F)
write_csv(grouper_fk_abun, "big_csv/trophic_groups/abundance/grouper_fk_abun.csv")
grouper_dt_abun = getDomainAbundance(RVCdata_DT, grouper_spp_list, merge_protected = F)
write_csv(grouper_dt_abun, "big_csv/trophic_groups/abundance/grouper_dt_abun.csv")
#density
grouper_fk_den = getDomainDensity(RVCdata_FK, grouper_spp_list, merge_protected = F)
write_csv(grouper_fk_den, "big_csv/trophic_groups/density/grouper_fk_den.csv")
grouper_dt_den = getDomainDensity(RVCdata_DT, grouper_spp_list, merge_protected = F)
write_csv(grouper_dt_den, "big_csv/trophic_groups/density/grouper_dt_den.csv")
#diversity metrics
grouper_fk_abundance = grouper_fk_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>%
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill =0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
grouper_fk_diversity = grouper_fk_abundance %>%
select(YEAR, protected_status, richness, shannon, simpson)
write_csv(grouper_fk_diversity, "big_csv/trophic_groups/diversity/grouper_fk_diversity.csv")
#diversity metrics
grouper_dt_abundance = grouper_dt_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>%
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill =0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
grouper_dt_diversity = grouper_dt_abundance %>%
select(YEAR, protected_status, richness, shannon, simpson)
write_csv(grouper_dt_diversity, "big_csv/trophic_groups/diversity/grouper_dt_diversity.csv")
}
Grunts
| Anisotremus surinamensis |
black margate |
ANI SURI |
| Anisotremus virginicus |
porkfish |
ANI VIRG |
| Haemulon album |
margate |
HAE ALBU |
| Haemulon aurolineatum |
tomtate |
HAE AURO |
| Haemulon carbonarium |
caesar grunt |
HAE CARB |
| Haemulon chrysargyreum |
smallmouth grunt |
HAE CHRY |
| Haemulon flavolineatum |
french grunt |
HAE FLAV |
| Haemulon macrostomum |
spanish grunt |
HAE MACR |
| Haemulon melanurum |
cottonwick |
HAE MELA |
| Haemulon parra |
sailors choice |
HAE PARR |
| Haemulon plumierii |
white grunt |
HAE PLUM |
| Haemulon sciurus |
bluestriped grunt |
HAE SCIU |
| Haemulon sp. |
grunt species |
HAE SPE. |
| Haemulon striatum |
striped grunt |
HAE STRI |
grunt_fk_abun_csv = "trophic_groups/abundance/grunt_fk_abun.csv"
grunt_dt_abun_csv = "trophic_groups/abundance/grunt_dt_abun.csv"
grunt_fk_den_csv = "trophic_groups/density/grunt_fk_den.csv"
grunt_dt_den_csv = "trophic_groups/density/grunt_dt_den.csv"
grunt_fk_diversity_csv= "trophic_groups/diversity/grunt_fk_diversity.csv"
grunt_dt_diversity_csv= "trophic_groups/diversity/grunt_dt_diversity.csv"
if(!all(file.exists(grunt_fk_abun_csv,grunt_dt_abun_csv,grunt_fk_den_csv,grunt_dt_den_csv,grunt_fk_diversity_csv,grunt_dt_diversity_csv))){
grunt_spp_list = c("HAE SCIU", "HAE AURO", "HAE PLUM", "HAE SPE.", "HAE FLAV", "HAE CHRY", "ANI VIRG","HAE MELA", "HAE CARB", "HAE PARR", "HAE STRI", "HAE MACR", "ANI SURI", "HAE ALBU")
#abundance
grunt_fk_abun = getDomainAbundance(RVCdata_FK, grunt_spp_list, merge_protected = F)
write_csv(grunt_fk_abun, "trophic_groups/abundance/grunt_fk_abun.csv")
grunt_dt_abun = getDomainAbundance(RVCdata_DT, grunt_spp_list, merge_protected = F)
write_csv(grunt_dt_abun, "trophic_groups/abundance/grunt_dt_abun.csv")
#density
grunt_fk_den = getDomainDensity(RVCdata_FK, grunt_spp_list, merge_protected = F)
write_csv(grunt_fk_den, "trophic_groups/density/grunt_fk_den.csv")
grunt_dt_den = getDomainDensity(RVCdata_DT, grunt_spp_list, merge_protected = F)
write_csv(grunt_dt_den, "trophic_groups/density/grunt_dt_den.csv")
#diversity metrics
grunt_fk_abundance = grunt_fk_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
grunt_fk_diversity = grunt_fk_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(grunt_fk_diversity, "trophic_groups/diversity/grunt_fk_diversity.csv")
#dt diversity
grunt_dt_abundance = grunt_dt_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
grunt_dt_diversity = grunt_dt_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(grunt_dt_diversity, "trophic_groups/diversity/grunt_dt_diversity.csv")
}
Higher Level Reef Fish
higher_reef_fk_abun_csv = "trophic_groups/abundance/higher_reef_fk_abun.csv"
higher_reef_dt_abun_csv = "trophic_groups/abundance/higher_reef_dt_abun.csv"
higher_reef_fk_den_csv = "trophic_groups/density/higher_reef_fk_den.csv"
higher_reef_dt_den_csv = "trophic_groups/density/higher_reef_dt_den.csv"
higher_reef_fk_diversity_csv= "trophic_groups/diversity/higher_reef_fk_diversity.csv"
higher_reef_dt_diversity_csv= "trophic_groups/diversity/higher_reef_dt_diversity.csv"
if(!all(file.exists(higher_reef_fk_abun_csv,higher_reef_dt_abun_csv,higher_reef_fk_den_csv,higher_reef_dt_den_csv,higher_reef_fk_diversity_csv,higher_reef_dt_diversity_csv))){
higher_reef_spp_list = c("THA BIFA","STE PART","GYM MORI","PRI AREN","ABU SAXA","HAL BIVI","HAL GARN","HAL MACU","CHR MULT","CLE PARR","STE PLAN","CHR CYAN","MUL MART","MIC CHRY","STE ADUS","CHA CAPI","STE VARI","PEM SCHO","POM ARCU","CAN ROST","CHA OCEL","PSE MACU","HOL TRIC","CHR SCOT","HAL RADI","CAL CALA","CHA SEDE","XYR SPLE","STE LEUC","HOL CILI","POM PARU","AUL MACU","CHA STRI","OPI AURI","HAL POEY","CHR INSO","HOL ADSC","ODO DENT","STE DIEN","HOL BERM","CHA FABE","XYR MART","GER CINE","HOL RUFU","LAC TRIQ","PAR ACUM","ALU SCRI","BAL CAPR","MAL PLUM","CAN SUFF","CAN PULL","HET CRUE","OGC SPE.","XYR SPE.","ACA QUAD","CAL BAJO","MON TUCK","SPH SPEN","ARC RHOM","DIO HOLO","LAC BICA","XYR NOVA","BAL VETU","DIO HYST","HAL CYAN","GYM FUNE","DIP HOLB","APO PSEU","HOL TOWN","EQU PUNC","LAC TRIG","HAL PICT","MYR JACO","SAR VEXI","SYN INTE","HAL CAUD","AMB PINO","GYM MILI","ALU SCHO","ACA POLY","CAL PROR","CHI SCHO","HET LONG","SCO PLUM","CHR ENCH","CAL SPE.","APO MACU","CAN MACR","PAR UMBR","LAG RHOM","EQU LANC","CAL PENN","STE HISP","APO BINO","NEO MARI","ARC PROB","CHI ANTE","APO TOWN","DOR MEGA","REM REMO","OPI WHIT","CEN ARGI","SYN FOET","AST SPE.","CAR HIPP","SAR CORU","OPI MACR","GYM VICI","DIP ARGE","PAG PAGR","PAR BAIR","BOT LUNA","EUC ARGE","PRO ACUL","LAB GOBI","FIS TABA","ALU SPE.","GRA LORE","MON CILI","ECH NEUC","ALU MONO","BOT OCEL","BAL SPE.","PAR ALBI","STE SPE.","APO QUAD","ENC NIGR","GYM SAXI","OPI SPE.","ELO SAUR","MAN BIRO","APO AURO","SPH TEST","CAL NODO","DIO SPE.","SCO CARI","LAB FILA","AHL EGMO","ANT OCEL","AST GUTT","LAB SPE.","LAB SPE.","MUR RETI","AST STEL","EUC GULA","HOL SPE.","ORT CHRY","PRI OPHR","LAB BUCC","ACA SOLA","CAL LEUC","ENC CARY","GYM NIGR","MYR BREV","SAR BULL","TRA GOOD","TRA LATH","UMB CORO","EUC JONE","EUCLEFR","STY LATE","SYA MICR","SYN SCOV","APO PHEN","HIP REID","PHA XENU","AST PUNC","CHI ATIN","CHL CHRY","HIP EREC","OGC NASU","SER PHOE","SPH NEPH","MYR OCEL","PRI RUBI","RHI LENT","ALB VULP","DAC VOLI","RYP BIST","BRO BARB","HYP GUMM","OPS TAU_","EMM ATLA","UPE PARV","SYN SYNO")
#abundance
higher_reef_fk_abun = getDomainAbundance(RVCdata_FK, higher_reef_spp_list, merge_protected = F)
write_csv(higher_reef_fk_abun, "big_csv/trophic_groups/abundance/higher_reef_fk_abun.csv")
higher_reef_dt_abun = getDomainAbundance(RVCdata_DT, higher_reef_spp_list, merge_protected = F)
write_csv(higher_reef_dt_abun, "big_csv/trophic_groups/abundance/higher_reef_dt_abun.csv")
#density
higher_reef_fk_den = getDomainDensity(RVCdata_FK, higher_reef_spp_list, merge_protected = F)
write_csv(higher_reef_fk_den, "big_csv/trophic_groups/density/higher_reef_fk_den.csv")
higher_reef_dt_den = getDomainDensity(RVCdata_DT, higher_reef_spp_list, merge_protected = F)
write_csv(higher_reef_dt_den, "big_csv/trophic_groups/density/higher_reef_dt_den.csv")
#fk diversity
higher_reef_fk_abundance = higher_reef_fk_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
higher_reef_diversity = higher_reef_fk_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(higher_reef_diversity, "big_csv/trophic_groups/diversity/higher_reef_fk_diversity.csv")
#dt diversity
higher_reef_dt_abundance = higher_reef_dt_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
higher_reef_diversity = higher_reef_dt_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(higher_reef_diversity, "big_csv/trophic_groups/diversity/higher_reef_dt_diversity.csv")
}
higher_reef_fk_den = read_csv("trophic_groups/density/higher_reef_fk_den.csv",
col_types = cols(protected_status = col_character()))
higher_reef_fk_density = higher_reef_fk_den %>%
select(YEAR, protected_status, SPECIES_CD, density) %>%
group_by(YEAR, protected_status) %>%
summarise(
ntot = sum(density)) %>%
filter(protected_status != "0") %>%
filter(protected_status != "1") %>%
mutate(
protected_status = recode(
protected_status, '0'='unprotected', '1'='protected')) %>%
spread(protected_status, ntot)
dygraph(higher_reef_fk_density, main = 'Higher Level Reef Fish Density') %>%
dyAxis("y", label = "Density") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 2)
Hogfish
| Bodianus pulchellus |
spotfin hogfish |
BOD PULC |
| Bodianus rufus |
Spanish hogfish |
BOD RUFU |
| Lachnolaimus maximus |
hogfish |
LAC MAXI |
hogfish_fk_abun_csv = "trophic_groups/abundance/hogfish_fk_abun.csv"
hogfish_dt_abun_csv = "trophic_groups/abundance/hogfish_dt_abun.csv"
hogfish_fk_den_csv = "trophic_groups/density/hogfish_fk_den.csv"
hogfish_dt_den_csv = "trophic_groups/density/hogfish_dt_den.csv"
hogfish_fk_diversity_csv= "trophic_groups/diversity/hogfish_fk_diversity.csv"
hogfish_dt_diversity_csv= "trophic_groups/diversity/hogfish_dt_diversity.csv"
if(!all(file.exists(hogfish_fk_abun_csv,hogfish_dt_abun_csv,hogfish_fk_den_csv,hogfish_dt_den_csv,hogfish_fk_diversity_csv,hogfish_dt_diversity_csv))){
hogfish_spp_list = c("LAC MAXI", "BOD RUFU", "BOD PULC")
#abundance
hogfish_fk_abun = getDomainAbundance(RVCdata_FK, hogfish_spp_list, merge_protected = F)
write_csv(hogfish_fk_abun, "big_csv/trophic_groups/abundance/hogfish_fk_abun.csv")
hogfish_dt_abun = getDomainAbundance(RVCdata_DT, hogfish_spp_list, merge_protected = F)
write_csv(hogfish_dt_abun, "big_csv/trophic_groups/abundance/hogfish_dt_abun.csv")
#density
hogfish_fk_den = getDomainDensity(RVCdata_FK, hogfish_spp_list, merge_protected = F)
write_csv(hogfish_fk_den, "big_csv/trophic_groups/density/hogfish_fk_den.csv")
hogfish_dt_den = getDomainDensity(RVCdata_DT, hogfish_spp_list, merge_protected = F)
write_csv(hogfish_dt_den, "big_csv/trophic_groups/density/hogfish_dt_den.csv")
#FK diversity
hogfish_fk_abundance = hogfish_fk_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
hogfish_fk_diversity = hogfish_fk_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(hogfish_fk_diversity, "big_csv/trophic_groups/diversity/hogfish_fk_diversity.csv")
#DT diversity
hogfish_dt_abundance = hogfish_dt_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
hogfish_dt_diversity = hogfish_dt_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(hogfish_dt_diversity, "big_csv/trophic_groups/diversity/hogfish_dt_diversity.csv")
}
Lionfish
| Pterois volitans |
red lionfish |
PTE VOLI |
lionfish_fk_abun_csv = "trophic_groups/abundance/lionfish_fk_abun.csv"
lionfish_dt_abun_csv = "trophic_groups/abundance/lionfish_dt_abun.csv"
lionfish_fk_den_csv = "trophic_groups/density/lionfish_fk_den.csv"
lionfish_dt_den_csv = "trophic_groups/density/lionfish_dt_den.csv"
if(!all(file.exists(lionfish_fk_abun_csv,lionfish_dt_abun_csv,lionfish_fk_den_csv,lionfish_dt_den_csv))){
#"PTE VOLI" - lionfish
#abundance
lionfish_fk_abun = getDomainAbundance(RVCdata_FK, "PTE VOLI", merge_protected = F)
write_csv(lionfish_fk_abun, "big_csv/trophic_groups/abundance/lionfish_fk_abun.csv")
lionfish_dt_abun = getDomainAbundance(RVCdata_DT, "PTE VOLI", merge_protected = F)
write_csv(lionfish_dt_abun, "big_csv/trophic_groups/abundance/lionfish_dt_abun.csv")
#density
lionfish_fk_den = getDomainDensity(RVCdata_FK, "PTE VOLI", merge_protected = F)
write_csv(lionfish_fk_den, "big_csv/trophic_groups/density/lionfish_fk_den.csv")
lionfish_dt_den = getDomainDensity(RVCdata_DT, "PTE VOLI", merge_protected = F)
write_csv(lionfish_dt_den, "big_csv/trophic_groups/density/lionfish_dt_den.csv")
}
Opportunists
| Alectis ciliaris |
african pompano |
ALE CILI |
| Caranx crysos |
blue runner |
CAR CRYS |
| Caranx bartholomaei |
yellow jack |
CAR BART |
| Caranx latus |
horse-eye jack |
CAR LATU |
| Caranx lugubris |
black jack |
CAR LUGU |
| Caranx ruber |
bar jack |
CAR RUBE |
| Caranx sp. |
jack species |
CAR SPE. |
| Decapterus punctatus |
round scad |
DEC PUNC |
| Decapterus macarellus |
mackerel scad |
DEC MACA |
| Elagatis bipinnulata |
rainbow runner |
ELA BIPI |
| Euthynnus alletteratus |
little tunny |
EUT ALLE |
| Oligoplites saurus |
leatherjack |
OLI SAUR |
| Sphyraena barracuda |
great barracuda |
SPH BARR |
| Rachycentron canadum |
cobia |
RAC CANA |
| Scomberomorus regalis |
cero |
SCO REGA |
| Sphyraena picudilla |
southern sennet |
SPH PICU |
| Selene vomer |
lookdown |
SEL VOME |
| Seriola rivoliana |
almaco jack |
SER RIVO |
| Scomberomorus maculatus |
spanish mackerel |
SCO MACU |
| Seriola dumerili |
greater amberjack |
SER DUME |
| Scomberomorus cavalla |
king mackerel |
SCO CAVA |
| Sphyraena guachancho |
guaguanche |
SPH GUAC |
| Seriola sp. |
jack species |
SER SPE. |
| Seriola zonata |
banded rudderfish |
SER ZONA |
| Trachinotus falcatus |
permit |
TRA FALC |
opportunists_fk_abun_csv = "trophic_groups/abundance/opportunists_fk_abun.csv"
opportunists_dt_abun_csv = "trophic_groups/abundance/opportunists_dt_abun.csv"
opportunists_fk_den_csv = "trophic_groups/density/opportunists_fk_den.csv"
opportunists_dt_den_csv = "trophic_groups/density/opportunists_dt_den.csv"
opportunists_fk_diversity_csv= "trophic_groups/diversity/opportunists_fk_diversity.csv"
opportunists_dt_diversity_csv= "trophic_groups/diversity/opportunists_dt_diversity.csv"
if(!all(file.exists(opportunists_fk_abun_csv,opportunists_dt_abun_csv,opportunists_fk_den_csv,opportunists_dt_den_csv,opportunists_fk_diversity_csv,opportunists_dt_diversity_csv))){
opportunists_spp_list = c("CAR RUBE", "SPH BARR", "ALE CILI","DEC PUNC", "DEC MACA", "CAR CRYS", "CAR BART", "SCO REGA","SPH PICU", "CAR LATU", "SEL VOME", "ELA BIPI", "CAR SPE.", "TRA FALC", "EUT ALLE", "SER RIVO", "SCO MACU", "SER DUME", "SCO CAVA", "SPH GUAC", "CAR LUGU", "OLI SAUR", "SER SPE.", "Rac cana", "Ser zona")
#abundance
opportunists_fk_abun = getDomainAbundance(RVCdata_FK, opportunists_spp_list, merge_protected = F)
write_csv(opportunists_fk_abun, "big_csv/trophic_groups/abundance/opportunists_fk_abun.csv")
opportunists_dt_abun = getDomainAbundance(RVCdata_DT, opportunists_spp_list, merge_protected = F)
write_csv(opportunists_dt_abun, "big_csv/trophic_groups/abundance/opportunists_dt_abun.csv")
#density
opportunists_fk_den = getDomainDensity(RVCdata_FK, opportunists_spp_list, merge_protected = F)
write_csv(opportunists_fk_den, "big_csv/trophic_groups/density/opportunists_fk_den.csv")
opportunists_dt_den = getDomainDensity(RVCdata_DT, opportunists_spp_list, merge_protected = F)
write_csv(opportunists_dt_den, "big_csv/trophic_groups/density/opportunists_dt_den.csv")
#diversity
opportunists_fk_abundance = opportunists_fk_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
opportunists_fk_diversity = opportunists_fk_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(opportunists_fk_diversity, "big_csv/trophic_groups/diversity/opportunists_fk_diversity.csv")
#dt diversity
opportunists_dt_abundance = opportunists_dt_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
opportunists_dt_diversity = opportunists_dt_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(opportunists_dt_diversity, "big_csv/trophic_groups/diversity/opportunists_dt_diversity.csv")
}
Parrotfish
| Cryptotomus roseus |
bluelip parrotfish |
CRY ROSE |
| Nicholsina usta |
emerald parrotfish |
NIC USTA |
| Scarus coelestinus |
midnight parrotfish |
SCA COEL |
| Scarus coeruleus |
blue parrotfish |
SCA COER |
| Scarus guacamaia |
rainbow parrotfish |
SCA GUAC |
| Scarus iseri |
striped parrotfish |
SCA ISER |
| Scarus sp. |
parrotfish species |
SCA SPE. |
| Scarus taeniopterus |
princess parrotfish |
SCA TAEN |
| Scarus vetula |
queen parrotfish |
SCA VETU |
| Sparisoma atomarium |
greenblotch parrotfish |
SPA ATOM |
| Sparisoma aurofrenatum |
redband parrotfish |
SPA AURO |
| Sparisoma chrysopterum |
redtail parrotfish |
SPA CHRY |
| Sparisoma radians |
bucktooth parrotfish |
SPA RADI |
| Sparisoma rubripinne |
yellowtail parrotfish |
SPA RUBR |
| Sparisoma sp. |
parrotfish species |
SPA SPE. |
| Sparisoma viride |
stoplight parrotfish |
SPA VIRI |
parrotfish_fk_abun_csv = "trophic_groups/abundance/parrotfish_fk_abun.csv"
parrotfish_dt_abun_csv = "trophic_groups/abundance/parrotfish_dt_abun.csv"
parrotfish_fk_den_csv = "trophic_groups/density/parrotfish_fk_den.csv"
parrotfish_dt_den_csv = "trophic_groups/density/parrotfish_dt_den.csv"
parrotfish_fk_diversity_csv = "trophic_groups/diversity/parrotfish_fk_diversity.csv"
parrotfish_dt_diversity_csv = "trophic_groups/diversity/parrotfish_dt_diversity.csv"
if(!all(file.exists(parrotfish_fk_abun_csv,parrotfish_dt_abun_csv,parrotfish_fk_den_csv,parrotfish_dt_den_csv,parrotfish_fk_diversity_csv,parrotfish_dt_diversity_csv))){
parrotfish_spp_list = c('SCA ISER', "SCA COEL", "SPA AURO", "SPA VIRI", "SPA ATOM", "SCA TAEN", 'SPA RUBR', "SPA CHRY", "SCA VETU", "SCA COER", "SCA GUAC", "CRY ROSE", "SPA RADI", "SCA SPE.", "NIC USTA", "SPA SPE.")
#abundance
parrotfish_fk_abun = getDomainAbundance(RVCdata_FK, parrotfish_spp_list, merge_protected = F)
write_csv(parrotfish_fk_abun, "big_csv/trophic_groups/abundance/parrotfish_fk_abun.csv")
parrotfish_dt_abun = getDomainAbundance(RVCdata_DT, parrotfish_spp_list, merge_protected = F)
write_csv(parrotfish_dt_abun, "big_csv/trophic_groups/abundance/parrotfish_dt_abun.csv")
#density
parrotfish_fk_den = getDomainDensity(RVCdata_FK, parrotfish_spp_list, merge_protected = F)
write_csv(parrotfish_fk_den, "big_csv/trophic_groups/density/parrotfish_fk_den.csv")
parrotfish_dt_den = getDomainDensity(RVCdata_DT, parrotfish_spp_list, merge_protected = F)
write_csv(parrotfish_dt_den, "big_csv/trophic_groups/density/parrotfish_dt_den.csv")
#diversity
parrotfish_fk_abundance = parrotfish_fk_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
parrotfish_fk_diversity = parrotfish_fk_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(parrotfish_fk_diversity, "big_csv/trophic_groups/diversity/parrotfish_fk_diversity.csv")
#dt diversity
parrotfish_dt_abundance = parrotfish_dt_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
parrotfish_dt_diversity = parrotfish_dt_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(parrotfish_dt_diversity, "big_csv/trophic_groups/diversity/parrotfish_dt_diversity.csv")
}
parrotfish_fk_abun = read_csv('trophic_groups/abundance/parrotfish_fk_abun.csv')
## Parsed with column specification:
## cols(
## YEAR = col_integer(),
## REGION = col_character(),
## SPECIES_CD = col_character(),
## abundance = col_double(),
## var = col_double(),
## n = col_integer(),
## nm = col_integer(),
## N = col_double(),
## NM = col_double(),
## protected_status = col_character()
## )
parrotfish_fk_abundance = parrotfish_fk_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>%
summarise(
ntot = sum(abundance)) %>%
filter(protected_status != "0") %>%
filter(protected_status != "1") %>%
mutate(
protected_status = recode(
protected_status, '0'='unprotected', '1'='protected')) %>%
spread(protected_status, ntot)
dygraph(parrotfish_fk_abundance, main = 'Parrotfish Abundance') %>%
dyAxis("y", label = "Abundance") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T)
parrotfish_fk_den = read_csv('trophic_groups/density/parrotfish_fk_den.csv')
## Parsed with column specification:
## cols(
## YEAR = col_integer(),
## REGION = col_character(),
## SPECIES_CD = col_character(),
## density = col_double(),
## var = col_double(),
## n = col_integer(),
## nm = col_integer(),
## N = col_double(),
## NM = col_double(),
## protected_status = col_character()
## )
parrotfish_fk_density = parrotfish_fk_den %>%
select(YEAR, protected_status, SPECIES_CD, density) %>%
group_by(YEAR, protected_status) %>%
summarise(
ntot = sum(density)) %>%
filter(protected_status != "0") %>%
filter(protected_status != "1") %>%
mutate(
protected_status = recode(
protected_status, '0'='unprotected', '1'='protected')) %>%
spread(protected_status, ntot)
dygraph(parrotfish_fk_density, main = 'Parrotfish Density') %>%
dyAxis("y", label = "Density") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 2)
Rays
| Aetobatus narinari |
spotted eagle ray |
AET NARI |
| Dasyatis americana |
southern stingray |
DAS AMER |
| Echeneis naucrates |
sharksucker |
ECH NAUC |
| Narcine bancroftii |
lesser electric ray |
NAR BANC |
| Rhinoptera bonasus |
cownosed ray |
RHI BONA |
| Urobatis jamaicensis |
yellow stingray |
URO JAMA |
rays_fk_abun_csv = "trophic_groups/abundance/rays_fk_abun.csv"
rays_dt_abun_csv = "trophic_groups/abundance/rays_dt_abun.csv"
rays_fk_den_csv = "trophic_groups/density/rays_fk_den.csv"
rays_dt_den_csv = "trophic_groups/density/rays_dt_den.csv"
rays_fk_diversity_csv= "trophic_groups/diversity/rays_fk_diversity.csv"
rays_dt_diversity_csv= "trophic_groups/diversity/rays_dt_diversity.csv"
if(!all(file.exists(rays_fk_abun_csv,rays_dt_abun_csv,rays_fk_den_csv,rays_dt_den_csv,rays_fk_diversity_csv,rays_dt_diversity_csv))){
rays_spp_list = c("URO JAMA", "ECH NAUC", "DAS AMER", "AET NARI", "NAR BANC", "Rhi bona")
#abundance
rays_fk_abun = getDomainAbundance(RVCdata_FK, rays_spp_list, merge_protected = F)
write_csv(rays_fk_abun, "big_csv/trophic_groups/abundance/rays_fk_abun.csv")
rays_dt_abun = getDomainAbundance(RVCdata_DT, rays_spp_list, merge_protected = F)
write_csv(rays_dt_abun, "big_csv/trophic_groups/abundance/rays_dt_abun.csv")
#density
rays_fk_den = getDomainDensity(RVCdata_FK, rays_spp_list, merge_protected = F)
write_csv(rays_fk_den, "big_csv/trophic_groups/density/rays_fk_den.csv")
rays_dt_den = getDomainDensity(RVCdata_DT, rays_spp_list, merge_protected = F)
write_csv(rays_dt_den, "big_csv/trophic_groups/density/rays_dt_den.csv")
#diversity
rays_fk_abundance = rays_fk_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
rays_fk_diversity = rays_fk_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(rays_fk_diversity, "big_csv/trophic_groups/diversity/rays_fk_diversity.csv")
#dt diversity
rays_dt_abundance = rays_dt_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
rays_dt_diversity = rays_dt_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(rays_dt_diversity, "big_csv/trophic_groups/diversity/rays_dt_diversity.csv")
}
Sea bass and Hamlets
| Alphestes afer |
mutton hamlet |
ALP AFER |
| Centropristis ocyurus |
bank sea bass |
CEN OCYU |
| Centropristis striata |
black sea bass |
CEN STRI |
| Diplectrum formosum |
sand perch |
DIP FORM |
| Epinephelus adscensionis |
rock hind |
EPI ADSC |
| Epinephelus drummondhayi |
speckled hind |
EPI DRUM |
| Epinephelus guttatus |
red hind |
EPI GUTT |
| Hypoplectrus chlorurus |
yellowtail hamlet |
HYP CHLO |
| Hypoplectrus gemma |
blue hamlet |
HYP GEMM |
| Hypoplectrus guttavarius |
shy hamlet |
HYP GUTT |
| Hypoplectrus hybrid |
hybrid hamlet |
HYP HYBR |
| Hypoplectrus indigo |
indigo hamlet |
HYP INDI |
| Hypoplectrus nigricans |
black hamlet |
HYP NIGR |
| Hypoplectrus puella |
barred hamlet |
HYP PUEL |
| Hypoplectrus sp. |
hamlet species |
HYP SPE. |
| Hypoplectrus tann |
tan hamlet |
HYP TANN |
| Hypoplectrus unicolor |
butter hamlet |
HYP UNIC |
| Liopropoma eukrines |
wrasse basslet |
LIO EUKR |
| Liopropoma mowbrayi |
cave basslet |
LIO MOWB |
| Liopropoma rubre |
peppermint basslet |
LIO RUBE |
| Paranthias furcifer |
atlantic creolefish |
PAR FURC |
| Pristipomoides aquilonaris |
wenchman |
PRI AQUI |
| Rypticus maculatus |
whitespotted soapfish |
RYP MACU |
| Rypticus saponaceus |
greater soapfish |
RYP SAPO |
| Schultzea beta |
school bass |
SCH BETA |
| Serranus annularis |
orangeback bass |
SER ANNU |
| Serranus baldwini |
lantern bass |
SER BALD |
| Serranus subligarius |
belted sandfish |
SER SUBL |
| Serranus tabacarius |
tobaccofish |
SER TABA |
| Serranus tigrinus |
harlequin bass |
SER TIGR |
| Serranus tortugarum |
chalk bass |
SER TORT |
seabass_fk_abun_csv = "trophic_groups/abundance/seabass_fk_abun.csv"
seabass_dt_abun_csv = "trophic_groups/abundance/seabass_dt_abun.csv"
seabass_fk_den_csv = "trophic_groups/density/seabass_fk_den.csv"
seabass_dt_den_csv = "trophic_groups/density/seabass_dt_den.csv"
seabass_fk_diversity_csv= "trophic_groups/diversity/seabass_fk_diversity.csv"
seabass_dt_diversity_csv= "trophic_groups/diversity/seabass_dt_diversity.csv"
if(!all(file.exists(seabass_fk_abun_csv,seabass_dt_abun_csv,seabass_fk_den_csv,seabass_dt_den_csv,seabass_fk_diversity_csv,seabass_dt_diversity_csv))){
sea_bass_hamlet_spp_list = c("SER TIGR","HYP GEMM","HYP UNIC","SER TABA","SER BALD","HYP PUEL","EPI ADSC","SER TORT","EPI GUTT","HYP NIGR","DIP FORM","HYP SPE.","SCH BETA","HYP TANN", "RYP SAPO","PAR FURC","HYP INDI","HYP GUTT","ALP AFER","LIO EUKR","SER ANNU","LIO RUBE","HYP HYBR","HYP CHLO","PRI AQUI","RYP MACU","SER SUBL","CEN OCYU","CEN STRI","Epi drum","Lio mowb")
#abundance
seabass_fk_abun = getDomainAbundance(RVCdata_FK, sea_bass_hamlet_spp_list, merge_protected = F)
write_csv(seabass_fk_abun, "big_csv/trophic_groups/abundance/seabass_fk_abun.csv")
seabass_dt_abun = getDomainAbundance(RVCdata_DT, sea_bass_hamlet_spp_list, merge_protected = F)
write_csv(seabass_dt_abun, "big_csv/trophic_groups/abundance/seabass_dt_abun.csv")
#density
seabass_fk_den = getDomainDensity(RVCdata_FK, sea_bass_hamlet_spp_list, merge_protected = F)
write_csv(seabass_fk_den, "big_csv/trophic_groups/density/seabass_fk_den.csv")
seabass_dt_den = getDomainDensity(RVCdata_DT, sea_bass_hamlet_spp_list, merge_protected = F)
write_csv(seabass_dt_den, "big_csv/trophic_groups/density/seabass_dt_den.csv")
#diversity
seabass_fk_abundance = seabass_fk_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
seabass_fk_diversity = seabass_fk_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(seabass_fk_diversity, "big_csv/trophic_groups/diversity/seabass_fk_diversity.csv")
#dt diversity
seabass_dt_abundance = seabass_dt_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
seabass_dt_diversity = seabass_dt_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(seabass_dt_diversity, "big_csv/trophic_groups/diversity/seabass_dt_diversity.csv")
}
Sharks
| Carcharhinus falciformis |
silky shark |
CAR FALC |
| Carcharhinus leucas |
bull shark |
CAR LEUC |
| Carcharhinus limbatus |
blacktip shark |
CAR LIMB |
| Carcharhinus obscurus |
dusky shark |
CAR OBSC |
| Carcharhinus plumbeus |
sandbar shark |
CAR PLUM |
| Carcharhinus perezii |
reef shark |
CAR PERE |
| Galeocerdo cuvieri |
tiger shark |
GAL CUVI |
| Ginglymostoma cirratum |
nurse shark |
GIN CIRR |
| Negaprion brevirostris |
lemon shark |
Neg BREV |
| Sphyrna mokarran |
great hammerhead |
SPH MOKA |
| Sphyrna tiburo |
bonnethead |
SPH TIBU |
| Sphyrna lewini |
scalloped hammerhead |
SPH LEWI |
sharks_fk_abun_csv = "trophic_groups/abundance/sharks_fk_abun.csv"
sharks_dt_abun_csv = "trophic_groups/abundance/sharks_dt_abun.csv"
sharks_fk_den_csv = "trophic_groups/density/sharks_fk_den.csv"
sharks_dt_den_csv = "trophic_groups/density/sharks_dt_den.csv"
sharks_fk_diversity_csv = "trophic_groups/diversity/sharks_fk_diversity.csv"
sharks_dt_diversity_csv = "trophic_groups/diversity/sharks_dt_diversity.csv"
if(!all(file.exists(sharks_fk_abun_csv,sharks_dt_abun_csv,sharks_fk_den_csv,sharks_dt_den_csv,sharks_fk_diversity_csv,sharks_dt_diversity_csv))){
sharks_spp_list = c("GIN CIRR", "CAR PERE", "CAR LEUC", "CAR LIMB", "SPH MOKA", "SPH TIBU", "CAR FALC", "SPH LEWI", "CAR OBSC", "Neg brev", "CAR PLUM", 'Gal cuvi')
#abundance
sharks_fk_abun = getDomainAbundance(RVCdata_FK, sharks_spp_list, merge_protected = F)
write_csv(sharks_fk_abun, "big_csv/trophic_groups/abundance/sharks_fk_abun.csv")
sharks_dt_abun = getDomainAbundance(RVCdata_DT, sharks_spp_list, merge_protected = F)
write_csv(sharks_dt_abun, "big_csv/trophic_groups/abundance/sharks_dt_abun.csv")
#density
sharks_fk_den = getDomainDensity(RVCdata_FK, sharks_spp_list, merge_protected = F)
write_csv(sharks_fk_den, "big_csv/trophic_groups/density/sharks_fk_den.csv")
sharks_dt_den = getDomainDensity(RVCdata_DT, sharks_spp_list, merge_protected = F)
write_csv(sharks_dt_den, "big_csv/trophic_groups/density/sharks_dt_den.csv")
#diversity
sharks_fk_abundance = sharks_fk_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
sharks_fk_diversity = sharks_fk_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(sharks_fk_diversity, "big_csv/trophic_groups/diversity/sharks_fk_diversity.csv")
#dt diversity
sharks_dt_abundance = sharks_dt_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
sharks_dt_diversity = sharks_dt_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(sharks_dt_diversity, "big_csv/trophic_groups/diversity/sharks_dt_diversity.csv")
}
sharks_fk_den= read_csv('trophic_groups/density/sharks_fk_den.csv')
## Parsed with column specification:
## cols(
## YEAR = col_integer(),
## REGION = col_character(),
## SPECIES_CD = col_character(),
## density = col_double(),
## var = col_double(),
## n = col_integer(),
## nm = col_integer(),
## N = col_double(),
## NM = col_double(),
## protected_status = col_character()
## )
sharks_fk_density = sharks_fk_den %>%
select(YEAR, protected_status, SPECIES_CD, density) %>%
group_by(YEAR, protected_status) %>%
summarise(
ntot = sum(density)) %>%
filter(protected_status != "0") %>%
filter(protected_status != "1") %>%
spread(protected_status, ntot)
dygraph(sharks_fk_density, main = 'Sharks Density') %>%
dyAxis("y", label = "Density") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 2)
Small Reef Fish
small_reef_fk_abun_csv = "trophic_groups/abundance/small_reef_fk_abun.csv"
small_reef_dt_abun_csv = "trophic_groups/abundance/small_reef_dt_abun.csv"
small_reef_fk_den_csv = "trophic_groups/density/small_reef_fk_den.csv"
small_reef_dt_den_csv = "trophic_groups/density/small_reef_dt_den.csv"
small_reef_fk_diversity_csv = "trophic_groups/diversity/small_reef_fk_diversity.csv"
small_reef_dt_diversity_csv = "trophic_groups/diversity/small_reef_dt_diversity.csv"
if(!all(file.exists(small_reef_fk_abun_csv,small_reef_dt_abun_csv,small_reef_fk_den_csv,small_reef_dt_den_csv,small_reef_fk_diversity_csv,small_reef_dt_diversity_csv))){
small_reef_fish_spp_list = c("COR PERS","ACA COER","KYP SECT","ACA BAHI","ACA CHIR","COR GLAU","ELA OCEA","GNA THOM","PTE CALL","ACA SPE.","MAL TRIA","COR DICR","PAR MARM","MAL MACR","OPH MACC","CTE SAEP","MIC CARR","PTE HELE","HEM SIMU","SCA CRIS","COR EIDO","GOB SPE.","TYL CROC","MIC MICR","ACA ASPE","COR SPE.","BLE SPE.","STR NOTA","MEL NIGE","HYP BERM","EMB PAND","ELA EVEL","ACA CHAP","EMB BAHA","COR LIPE","NES LONG","ENN BOEH","ACA MARI","LAB NUCH","MAL VERS","MAL GILL","ELA MACR","PRI HIPO","GOB DILE","ELA SAUC","ELA XANT","STR TIMU","MAL AURO","PAR MARN","CHA LIMB","OXY STIG","ELA HORS","PAR NIGR","COR PUNC","ACA SPIN","BOL BOQU","ElA RAND","LAB KALI","LAB NIGR","ENN ALTI")
#abundance
small_reef_fk_abun = getDomainAbundance(RVCdata_FK, small_reef_fish_spp_list, merge_protected = F)
write_csv(small_reef_fk_abun, "big_csv/trophic_groups/abundance/small_reef_fk_abun.csv")
small_reef_dt_abun = getDomainAbundance(RVCdata_DT, small_reef_fish_spp_list, merge_protected = F)
write_csv(small_reef_dt_abun, "big_csv/trophic_groups/abundance/small_reef_dt_abun.csv")
#density
small_reef_fk_den = getDomainDensity(RVCdata_FK, small_reef_fish_spp_list, merge_protected = F)
write_csv(small_reef_fk_den, "big_csv/trophic_groups/density/small_reef_fk_den.csv")
small_reef_dt_den = getDomainDensity(RVCdata_DT, small_reef_fish_spp_list, merge_protected = F)
write_csv(small_reef_dt_den, "big_csv/trophic_groups/density/small_reef_dt_den.csv")
#fk diversity
small_reef_fk_abundance = small_reef_fk_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
small_reef_fk_diversity = small_reef_fk_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(small_reef_fk_diversity, "big_csv/trophic_groups/diversity/small_reef_fk_diversity.csv")
#dt diversity
small_reef_dt_abundance = small_reef_dt_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
small_reef_dt_diversity = small_reef_dt_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(small_reef_dt_diversity, "big_csv/trophic_groups/diversity/small_reef_dt_diversity.csv")
}
Snappers
| Lutjanus analis |
mutton snapper |
LUT ANAL |
| Lutjanus apodus |
schoolmaster |
LUT APOD |
| Lutjanus buccanella |
blackfin snapper |
LUT BUCC |
| Lutjanus campechanus |
red snapper |
Lut CAMP |
| Lutjanus cyanopterus |
cubera snapper |
LUT CYAN |
| Lutjanus griseus |
gray snapper |
LUT GRIS |
| Lutjanus jocu |
dog snapper |
LUT JOCU |
| Lutjanus mahogoni |
mahogany snapper |
LUT MAHO |
| Lutjanus synagris |
lane snapper |
LUT SYNA |
| Ocyurus chrysurus |
yellowtail snapper |
OCY CHRY |
| Rhomboplites aurorubens |
vermilion snapper |
RHO AURO |
| snapper species |
snapper species |
LUT SPE. |
snapper_fk_abun_csv = "trophic_groups/abundance/snapper_fk_abun.csv"
snapper_dt_abun_csv = "trophic_groups/abundance/snapper_dt_abun.csv"
snapper_fk_den_csv = "trophic_groups/density/snapper_fk_den.csv"
snapper_dt_den_csv = "trophic_groups/density/snapper_dt_den.csv"
snapper_fk_diversity_csv = "trophic_groups/diversity/snapper_fk_diversity.csv"
snapper_dt_diversity_csv = "trophic_groups/diversity/snapper_dt_diversity.csv"
if(!all(file.exists(snapper_fk_abun_csv,snapper_dt_abun_csv,snapper_fk_den_csv,snapper_dt_den_csv,snapper_fk_diversity_csv,snapper_dt_diversity_csv))){
snapper_spp_list = c("OCY CHRY", "LUT GRIS", "LUT ANAL", "LUT APOD", "LUT SYNA", "LUT MAHO", "LUT JOCU", "LUT BUCC", 'LUT SPE.', "LUT CYAN", "RHO AURO", "Lut camp")
#abundance
snapper_fk_abun = getDomainAbundance(RVCdata_FK, snapper_spp_list, merge_protected = F)
write_csv(snapper_fk_abun, "big_csv/trophic_groups/abundance/snapper_fk_abun.csv")
snapper_dt_abun = getDomainAbundance(RVCdata_DT, snapper_spp_list, merge_protected = F)
write_csv(snapper_dt_abun, "big_csv/trophic_groups/abundance/snapper_dt_abun.csv")
#density
snapper_fk_den = getDomainDensity(RVCdata_FK, snapper_spp_list, merge_protected = F)
write_csv(snapper_fk_den, "big_csv/trophic_groups/density/snapper_fk_den.csv")
snapper_dt_den = getDomainDensity(RVCdata_DT, snapper_spp_list, merge_protected = F)
write_csv(snapper_dt_den, "big_csv/trophic_groups/density/snapper_dt_den.csv")
#diversity
snapper_fk_abundance = snapper_fk_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
snapper_fk_diversity = snapper_fk_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(snapper_fk_diversity, "big_csv/trophic_groups/diversity/snapper_fk_diversity.csv")
#dt diversity
snapper_dt_abundance = snapper_dt_abun %>%
select(YEAR, protected_status, SPECIES_CD, abundance) %>%
group_by(YEAR, protected_status) %>% #48 groups
nest(-YEAR) %>%
mutate(
data_wide = map(data, ~ spread(data=.x, SPECIES_CD, abundance, fill = 0)),
#species richness
richness = map(
data_wide,
function(x) specnumber(x)),
#simpson diversity as effective number of species
simpson = map(
data_wide,
function(x) 1/(1 - diversity(x, index = 'simpson'))),
#shannon diversity as effective number of species
shannon = map(
data_wide,
function(x) exp(diversity(x, index = 'shannon')))) %>%
unnest(richness, simpson, shannon)
snapper_dt_diversity = snapper_dt_abundance %>%
select(YEAR, protected_status, richness, simpson, shannon)
write_csv(snapper_dt_diversity, "big_csv/trophic_groups/diversity/snapper_dt_diversity.csv")
}
snapper_fk_den = read_csv("trophic_groups/density/snapper_fk_den.csv",
col_types = cols(protected_status = col_character()))
snapper_fk_density = snapper_fk_den %>%
select(YEAR, protected_status, SPECIES_CD, density) %>%
group_by(YEAR, protected_status) %>%
summarise(
ntot = sum(density)) %>%
filter(protected_status != "0") %>%
filter(protected_status != "1") %>%
mutate(
protected_status = recode(
protected_status, '0'='unprotected', '1'='protected')) %>%
spread(protected_status, ntot)
dygraph(snapper_fk_density, main = 'Snapper Density') %>%
dyAxis("y", label = "Density") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 2)
Read in abundance, density, and diversity csv files for trophic groups
# read in all abundance csv files for trophic groups
path = "trophic_groups/abundance/"
files = list.files(path=path, pattern = "*.csv")
for(file in files){
perpos <- which(strsplit(file, "")[[1]]==".")
assign(
gsub(" ","",substr(file, 1, perpos-1)),
read.csv(paste(path, file, sep= "")))
}
# read in all density csv files for trophic groups
path = "trophic_groups/density/"
files = list.files(path=path, pattern = "*.csv")
for(file in files){
perpos <- which(strsplit(file, "")[[1]]==".")
assign(
gsub(" ","",substr(file, 1, perpos-1)),
read.csv(paste(path, file, sep= "")))
}
# read in all diversity csv files for trophic groups
path = "trophic_groups/diversity/"
files = list.files(path=path, pattern = "*.csv")
for(file in files){
perpos <- which(strsplit(file, "")[[1]]==".")
assign(
gsub(" ","",substr(file, 1, perpos-1)),
read.csv(paste(path, file, sep= "")))
}
Exploited reef fish
| Cephalopholis cruentata |
Graysby |
CEP CRUE |
exploited |
| Epinephelus itajara |
Goliath grouper |
EPI ITAJ |
moritorium |
| Epinephelus striatus |
Nassau grouper |
EPI STRI |
moritorium |
| Epinephelus Morio |
Red grouper |
EPI MORI |
exploited |
| Lachnolaimus maximus |
Hogfish |
LAC MAXI |
exploited |
| Lutjanus analis |
Mutton snapper |
LUT ANAL |
exploited |
| Lutjanus griseus |
Grey snapper |
LUT GRIS |
exploited |
| Mycteroperca bonaci |
Black grouper |
MYC BONA |
exploited |
| Ocyurus chrysurus |
Yellowtail snapper |
OCY CHRY |
exploited |
exploited_fk_abun_csv = "exploited_species/exploited_fk_abun.csv"
exploited_dt_abun_csv = "exploited_species/exploited_dt_abun.csv"
exploited_fk_den_csv = "exploited_species/exploited_fk_den.csv"
exploited_dt_den_csv = "exploited_species/exploited_dt_den.csv"
if(!all(file.exists(exploited_fk_abun_csv, exploited_dt_abun_csv, exploited_fk_den_csv, exploited_dt_den_csv))){
exploited_spp_list= c(
"CEP CRUE", #Graysby
"EPI ITAJ", #Goliath Grouper
"EPI MORI", #Red Grouper
"EPI STRI", #Nassau Grouper
"LAC MAXI", #Hogfish
"LUT ANAL", #Mutton Snapper
"LUT GRIS", #Grey Snapper
"MYC BONA", #Black Grouper
"OCY CHRY" #Yellowtail Snapper
)
#abundance
exploited_fk_abun <- getDomainAbundance(RVCdata_FK, species = exploited_spp_list, merge_protected = F)
write_csv(exploited_fk_abun,"big_csv/exploited/exploited_fk_abun.csv")
exploited_dt_abun <- getDomainAbundance(RVCdata_DT, species = exploited_spp_list, merge_protected = F)
write_csv(exploited_dt_abun,"big_csv/exploited/exploited_dt_abun.csv")
#density
exploited_fk_den <- getDomainDensity(RVCdata_FK, species = exploited_spp_list, merge_protected = F)
write_csv(exploited_fk_den,"big_csv/exploited/exploited_fk_den.csv")
exploited_dt_den <- getDomainDensity(RVCdata_DT, species = exploited_spp_list, merge_protected = F)
write_csv(exploited_dt_den,"big_csv/exploited/exploited_dt_den.csv")
}
exploited_den = read_csv("exploited_species/exploited_fk_den.csv")
## Parsed with column specification:
## cols(
## YEAR = col_integer(),
## REGION = col_character(),
## SPECIES_CD = col_character(),
## density = col_double(),
## var = col_double(),
## n = col_integer(),
## nm = col_integer(),
## N = col_double(),
## NM = col_double(),
## protected_status = col_character()
## )
exploited_density = exploited_den %>%
mutate(
protected_status = recode(
protected_status, '0'='unprotected', '1'='protected'),
common_name = recode(
SPECIES_CD,
'CEP CRUE' = 'Graysby',
'EPI ITAJ' = 'Goliath_Grouper',
'EPI MORI' = 'Red_Grouper',
'EPI STRI' = 'Nassau_Grouper',
'LAC MAXI' = 'Hogfish',
'LUT ANAL' = 'Mutton_Snapper',
'LUT GRIS' = 'Grey_Snapper',
'MYC BONA' = 'Black_Grouper',
'OCY CHRY' = 'Yellowtail_Snapper')) %>%
select(YEAR, common_name, protected_status, density) %>%
group_by(YEAR, common_name, protected_status) %>%
filter(protected_status != "all") %>%
summarise(
ntot = sum(density)) %>%
spread(common_name, ntot)
#Graysby density
Graysby = exploited_density %>%
select(YEAR, protected_status, Graysby) %>%
spread(protected_status, Graysby)
dygraph(Graysby, main = 'Graysby Density') %>%
dyAxis("y", label = "Density") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T)
#Grey_Snapper density
Grey_Snapper = exploited_density %>%
select(YEAR, protected_status, Grey_Snapper) %>%
spread(protected_status, Grey_Snapper)
dygraph(Grey_Snapper, main = 'Grey Snapper Density') %>%
dyAxis("y", label = "Density") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 2)
#Hogfish density
Hogfish = exploited_density %>%
select(YEAR, protected_status, Hogfish) %>%
spread(protected_status, Hogfish)
dygraph(Hogfish, main = 'Hogfish Density') %>%
dyAxis("y", label = "Density") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 2)
#Goliath grouper density
Goliath_Grouper = exploited_density %>%
select(YEAR, protected_status, Goliath_Grouper) %>%
spread(protected_status, Goliath_Grouper)
dygraph(Goliath_Grouper, main = 'Goliath Grouper Density') %>%
dyAxis("y", label = "Density") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 2)
##Nassau Grouper
Nassau_Grouper = exploited_density %>%
select(YEAR, protected_status, Nassau_Grouper) %>%
spread(protected_status, Nassau_Grouper)
dygraph(Nassau_Grouper, main = 'Nassau Grouper Density') %>%
dyAxis("y", label = "Density") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = )
##Yellowtail Snapper
yellowtail_snapper = exploited_density %>%
select(YEAR, protected_status, Yellowtail_Snapper) %>%
spread(protected_status, Yellowtail_Snapper)
dygraph(yellowtail_snapper, main = 'Yellowtail Snapper Density') %>%
dyAxis("y", label = "Density") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 2)
#exploited reef fish density in protected areas
exploited_density_protected = exploited_density %>%
filter(protected_status == 'protected') %>%
select(YEAR, Black_Grouper, Goliath_Grouper, Graysby, Grey_Snapper, Hogfish, Mutton_Snapper, Nassau_Grouper,Red_Grouper, Yellowtail_Snapper)
dygraph(exploited_density_protected, main = "Exploited Reef Fish Density in Protected Areas") %>%
dyAxis("y", label = "Density") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 2, colors = rainbow(9))
Reef Fish Biodiversity
domain_fk_abun_diversity = read_csv('big_csv/abundance_domain/domain_fk_abun_diversity.csv')
## Parsed with column specification:
## cols(
## YEAR = col_integer(),
## protected_status = col_character(),
## dom_richness = col_integer(),
## dom_simpson = col_double(),
## dom_shannon = col_double()
## )
domain_dt_abun_diversity = read_csv("big_csv/abundance_domain/domain_dt_abun_diversity.csv")
## Parsed with column specification:
## cols(
## YEAR = col_integer(),
## protected_status = col_character(),
## dom_richness = col_integer(),
## dom_simpson = col_double(),
## dom_shannon = col_double()
## )
strata_fk_abun_diversity = read_csv("big_csv/abundance_strata/strata_fk_abun_diversity.csv")
## Parsed with column specification:
## cols(
## YEAR = col_integer(),
## STRAT = col_character(),
## protected_status = col_character(),
## strata_richness = col_integer(),
## strata_simpson = col_double(),
## strata_shannon = col_double()
## )
strata_dt_abun_diversity = read_csv("big_csv/abundance_strata/strata_dt_abun_diversity.csv")
## Parsed with column specification:
## cols(
## YEAR = col_integer(),
## STRAT = col_character(),
## PROT = col_integer(),
## strata_richness = col_integer(),
## strata_simpson = col_double(),
## strata_shannon = col_double()
## )
psu_fk_abun_diversity = read_csv("big_csv/abundance_psu/psu_fk_abun_diversity.csv",
col_types = cols(protected_status = col_character()))
psu_dt_abun_diversity = read_csv("big_csv/abundance_psu/psu_dt_abun_diversity.csv")
## Parsed with column specification:
## cols(
## YEAR = col_integer(),
## PRIMARY_SAMPLE_UNIT = col_character(),
## psu_richness = col_integer(),
## psu_simpson = col_double(),
## psu_shannon = col_double()
## )
domain_fk_abun_diversity = read_csv('big_csv/abundance_domain/domain_fk_abun_diversity.csv')
## Parsed with column specification:
## cols(
## YEAR = col_integer(),
## protected_status = col_character(),
## dom_richness = col_integer(),
## dom_simpson = col_double(),
## dom_shannon = col_double()
## )
## Simpson for protected and unprotected stacked
fk_simpson = domain_fk_abun_diversity %>%
filter(protected_status != 'all') %>%
select(YEAR, protected_status, dom_simpson) %>%
mutate(
protected_status = recode(
protected_status, '0'='Unprotected', '1'='Protected')) %>%
spread(protected_status, dom_simpson)
dygraph(fk_simpson, main = "Simpson Reef Fish Diversity") %>%
dyAxis("y", label = "Effective Number of Species", valueRange = c(0, 50)) %>%
dyAxis("x", label = "Year") %>%
dySeries("Protected", strokeWidth = 2, strokePattern = "dashed") %>%
dySeries("Unprotected", strokeWidth = 2) %>%
dyOptions(stackedGraph = T, fillAlpha = 0.8, axisLineWidth = 2)
#dyRangeSelector(height = 20)
## Shannon for protected and unprotected stacked
fk_shannon = domain_fk_abun_diversity %>%
filter(protected_status != 'all') %>%
select(YEAR, protected_status, dom_shannon) %>%
mutate(
protected_status = recode(
protected_status, '0'='Unprotected', '1'='Protected')) %>%
spread(protected_status, dom_shannon)
dygraph(fk_shannon, main = "Shannon Reef Fish Diversity") %>%
dyAxis("y", label = "Effective Number of Species", valueRange = c(0, 75)) %>%
dyAxis("x", label = "Year") %>%
dySeries("Protected", strokeWidth = 2, strokePattern = "dashed") %>%
dySeries("Unprotected", strokeWidth = 2) %>%
dyOptions(stackedGraph = T, fillAlpha = 0.8, axisLineWidth = 2)
#dyRangeSelector(height = 20)
d = domain_fk_abun_diversity %>%
filter(protected_status != 0) %>%
filter(protected_status != 1)
#Simpson for "all" filled
dygraph_simp = d %>%
select(YEAR, dom_simpson)
dygraph(dygraph_simp, main = "Simpson Diversity of Reef Fish in FKNMS") %>%
dyOptions(fillGraph = T, fillAlpha = 0.4, drawPoints = T, pointSize = 2) %>%
dySeries("dom_simpson", label = "Simpson Diversity", color = "red") %>%
dyAxis("y", label = "Effective Number of Species") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 2)
#Shannon for "all" filled
dygraph_shannon = d %>%
select(YEAR, dom_shannon)
dygraph(dygraph_shannon, main = "Shannon Diversity of Reef Fish in FKNMS") %>%
dyOptions(fillGraph = T, fillAlpha = 0.4, drawPoints = T, pointSize = 2) %>%
dySeries("dom_shannon", label = "Shannon Diversity", color = "blue") %>%
dyAxis("y", label = "Effective Number of Species") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 2)
#Richness for "all" filled
dygraph_richness = d %>%
select(YEAR, dom_richness)
dygraph(dygraph_richness, main = "Species Richness of Reef Fish in FKNMS") %>%
dyOptions(fillGraph = T, fillAlpha = 0.4, drawPoints = T, pointSize = 2) %>%
dySeries("dom_richness", label = "Species Richness", color = "purple") %>%
dyAxis("y", label = "Number of Species") %>%
dyAxis("x", label = "Year") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 2)
## Simpson and Shannon stacked for "all"
dygraph_simp_shannon = d %>%
select(YEAR, dom_simpson, dom_shannon)
dygraph(dygraph_simp_shannon, main = "Florida Keys Reef Fish Biodiversity") %>%
dyAxis("y", label = "Effective Number of Species", valueRange = c(0, 70)) %>%
dyAxis("x", label = "Year") %>%
dySeries("dom_shannon", label = "Shannon Diversity", color = "blue") %>%
dySeries("dom_simpson", label = "Simpson Diversity", color = "red") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 1.5) %>% #drawGrid = F
dyLegend(width = 400)
#Richness, Shannon, Simpson stacked for "all"
dygraph_rich_simp_shannon = d %>%
select(YEAR, dom_simpson, dom_shannon, dom_richness)
dygraph(dygraph_rich_simp_shannon, main = "Florida Keys Reef Fish Biodiversity") %>%
dyAxis("y", label = "Effective Number of Species") %>%
dyAxis("x", label = "Year") %>%
dySeries("dom_richness", label = "Richness", color = "purple") %>%
dySeries("dom_shannon", label = "Shannon", color = "blue") %>%
dySeries("dom_simpson", label = "Simpson", color = "red") %>%
dyOptions(stackedGraph = T, fillAlpha = 0.6, axisLineWidth = 2) %>% #drawGrid = F
dyLegend(width = 400)