suppressPackageStartupMessages({
library(dplyr)
library(treemap)
library(ggplot2)
library(kableExtra)
})
## filter spp dataset by groups number
filter_group <- function (df, groupnumber) {
df %>%
filter(!is.na(UQ(sym(groupnumber))))
}
## summarise by taxonomic group name
summarise_group <- function(df, groupnumber) {
groupnumber<- as.symbol(groupnumber)
groupnumber<- enquo(groupnumber)
df %>%
group_by((!!groupnumber)) %>%
summarize(n = n())
}
# Read in spp_bbnj.csv with groupings:
# groups00: All original AquaMaps species
# groups01: 1st taxonomic grouping [n = 23]
# groups02: 1st grouping, species (prob≥ 0.5) in high seas
# groups03: 1st grouping, species (prob ≥ 0.5) and 25% of its range in high seas
# groups04: 2nd taxonomic grouping [n = 9]
# groups05: 2nd grouping, species (prob≥ 0.5) in high seas
# groups06: 2nd grouping, species (prob ≥ 0.5) and 25% of its range in high seas
spp <- readr::read_csv("extdata/spp_bbnj.csv")
groupnumber<-"groups01"
spp_grp<-filter_group(spp,groupnumber)
nspp_grp<-nrow(spp_grp)
taxa_grp <-summarise_group(spp_grp,groupnumber)
ngrp_grp <-nrow(taxa_grp)
All AquaMaps (no HS filter)
24 Taxonomic Groups
24904 Species
#Create treemap where size of rectangle corresponds to number of species in each group
taxa_treemap<- treemap(taxa_grp,
index=groupnumber,
vSize="n",
type="index",
force.print.labels = TRUE,
title="Number of species per group"
)
#Create table of nspp for each taxonomic group
knitr::kable(taxa_grp,
col.names = c("Group",
"Number of Species")) %>%
kable_styling(bootstrap_options = "striped")
Group | Number of Species |
---|---|
Bivalves | 1018 |
Bony fishes | 11409 |
Cephalopods | 295 |
Cetaceans | 82 |
Chitons | 81 |
Corals | 918 |
Crustaceans | 3058 |
Echinoderms | 956 |
Euphausiids | 43 |
Forams | 16 |
Gastropods | 2852 |
Hydrozoans | 321 |
Jellyfish | 19 |
Mangroves | 1 |
Other | 973 |
Pinnipeds | 32 |
Reptiles | 34 |
Sea spiders | 332 |
Seagrasses | 10 |
Sharks & rays | 834 |
Sponges | 440 |
Tunas & billfishes | 63 |
Tunicates | 666 |
Worms | 451 |
groupnumber<-"groups02"
spp_grp<-filter_group(spp,groupnumber)
nspp_grp<-nrow(spp_grp)
taxa_grp <-summarise_group(spp_grp,groupnumber)
ngrp_grp <-nrow(taxa_grp)
AquaMaps species (prob≥ 0.5) in high seas
23 Taxonomic Groups
11900 Species
#Create treemap where size of rectangle corresponds to number of species in each group
taxa_treemap<- treemap(taxa_grp,
index=groupnumber,
vSize="n",
type="index",
force.print.labels = TRUE,
title="Number of species per group"
)
#Create table of nspp for each taxonomic group
knitr::kable(taxa_grp,
col.names = c("Group",
"Number of Species")) %>%
kable_styling(bootstrap_options = "striped")
Group | Number of Species |
---|---|
Bivalves | 468 |
Bony fishes | 5095 |
Cephalopods | 153 |
Cetaceans | 69 |
Chitons | 19 |
Corals | 435 |
Crustaceans | 1871 |
Echinoderms | 438 |
Euphausiids | 35 |
Forams | 5 |
Gastropods | 935 |
Hydrozoans | 247 |
Jellyfish | 13 |
Other | 540 |
Pinnipeds | 25 |
Reptiles | 20 |
Sea spiders | 217 |
Seagrasses | 3 |
Sharks & rays | 396 |
Sponges | 134 |
Tunas & billfishes | 39 |
Tunicates | 446 |
Worms | 297 |
groupnumber<-"groups03"
spp_grp<-filter_group(spp,groupnumber)
nspp_grp<-nrow(spp_grp)
taxa_grp <-summarise_group(spp_grp,groupnumber)
ngrp_grp <-nrow(taxa_grp)
AquaMaps species (prob≥ 0.5) in high seas and 25% of its range in high seas
22 Taxonomic Groups
2051 Species
#Create treemap where size of rectangle corresponds to number of species in each group
taxa_treemap<- treemap(taxa_grp,
index=groupnumber,
vSize="n",
type="index",
force.print.labels = TRUE,
title="Number of species per group"
)
#Create table of nspp for each taxonomic group
knitr::kable(taxa_grp,
col.names = c("Group",
"Number of Species")) %>%
kable_styling(bootstrap_options = "striped")
Group | Number of Species |
---|---|
Bivalves | 12 |
Bony fishes | 1325 |
Cephalopods | 33 |
Cetaceans | 52 |
Chitons | 1 |
Corals | 10 |
Crustaceans | 175 |
Echinoderms | 33 |
Euphausiids | 1 |
Forams | 2 |
Gastropods | 52 |
Hydrozoans | 9 |
Jellyfish | 2 |
Other | 62 |
Pinnipeds | 8 |
Reptiles | 1 |
Sea spiders | 64 |
Sharks & rays | 49 |
Sponges | 9 |
Tunas & billfishes | 21 |
Tunicates | 84 |
Worms | 46 |
groupnumber<-"groups04"
spp_grp<-filter_group(spp,groupnumber)
nspp_grp<-nrow(spp_grp)
taxa_grp <-summarise_group(spp_grp,groupnumber)
ngrp_grp <-nrow(taxa_grp)
All AquaMaps (no HS filter)
9 Taxonomic Groups
24904 Species
#Create treemap where size of rectangle corresponds to number of species in each group
taxa_treemap<- treemap(taxa_grp,
index=groupnumber,
vSize="n",
type="index",
force.print.labels = TRUE,
title="Number of species per group"
)
#Create table of nspp for each taxonomic group
knitr::kable(taxa_grp,
col.names = c("Group",
"Number of Species")) %>%
kable_styling(bootstrap_options = "striped")
Group | Number of Species |
---|---|
Bony fishes | 11409 |
Cephalopods | 295 |
Corals | 918 |
Invertebrates | 10550 |
Marine Mammals | 119 |
Other | 706 |
Seagrasses | 10 |
Sharks & rays | 834 |
Tunas & billfishes | 63 |
groupnumber<-"groups05"
spp_grp<-filter_group(spp,groupnumber)
nspp_grp<-nrow(spp_grp)
taxa_grp <-summarise_group(spp_grp,groupnumber)
ngrp_grp <-nrow(taxa_grp)
AquaMaps species (prob≥ 0.5) in high seas
9 Taxonomic Groups
11900 Species
#Create treemap where size of rectangle corresponds to number of species in each group
taxa_treemap<- treemap(taxa_grp,
index=groupnumber,
vSize="n",
type="index",
force.print.labels = TRUE,
title="Number of species per group"
)
#Create table of nspp for each taxonomic group
knitr::kable(taxa_grp,
col.names = c("Group",
"Number of Species")) %>%
kable_styling(bootstrap_options = "striped")
Group | Number of Species |
---|---|
Bony fishes | 5095 |
Cephalopods | 153 |
Corals | 435 |
Invertebrates | 5339 |
Marine Mammals | 95 |
Other | 345 |
Seagrasses | 3 |
Sharks & rays | 396 |
Tunas & billfishes | 39 |
groupnumber<-"groups06"
spp_grp<-filter_group(spp,groupnumber)
nspp_grp<-nrow(spp_grp)
taxa_grp <-summarise_group(spp_grp,groupnumber)
ngrp_grp <-nrow(taxa_grp)
AquaMaps species (prob≥ 0.5) in high seas and 25% of its range in high seas
8 Taxonomic Groups
2051 Species
#Create treemap where size of rectangle corresponds to number of species in each group
taxa_treemap<- treemap(taxa_grp,
index=groupnumber,
vSize="n",
type="index",
force.print.labels = TRUE,
title="Number of species per group"
)
#Create table of nspp for each taxonomic group
knitr::kable(taxa_grp,
col.names = c("Group",
"Number of Species")) %>%
kable_styling(bootstrap_options = "striped")
Group | Number of Species |
---|---|
Bony fishes | 1325 |
Cephalopods | 33 |
Corals | 10 |
Invertebrates | 527 |
Marine Mammals | 60 |
Other | 26 |
Sharks & rays | 49 |
Tunas & billfishes | 21 |