Calculate biomass and plotting

Loading libraries and data

library(tidyverse)

## Cargamos los datos desde internet

base <- read.csv("https://www.dropbox.com/s/st52i2c7yx3vyki/base_monitoreo.csv?dl=1")

Data Wrangling

We filter by fishes and then calculate the biomass using the formula

base <- base %>% 
        filter(Label == "PEC") %>% 
        mutate(Biomass = (Quantity * A_ord * (Size^B_pen))/(Area * 100)) 

We then summarize data by region. First we sum by transect (our sampling unit) and then we estimate by calculating the average.

grafico <- base %>% 
        group_by(Year, Region, Reef, Depth, Transect) %>% 
        summarise(Quantity = sum(Quantity), 
                  Biomass = sum(Biomass)) %>% 
        group_by(Year, Region) %>% 
        summarise(Quantity = mean(Quantity), 
                  Biomass = mean(Biomass))

Graph

ggplot(grafico, aes(x = Region, y = Biomass)) +
        geom_col()

Written on February 19, 2021