Skip to content

clarajegousse/fishR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fishr

An R package for downloading, cleaning, and visualising FAO global capture fisheries data.

Installation

# install.packages("remotes")
remotes::install_github("https://github.com/clarajegousse/fishR/fishr")

Overview

fishr wraps the FAO Global Capture Production dataset with a small set of functions to get you from raw data to analysis-ready tibbles and plots with minimal friction.

Function What it does
download_fao_capture() Downloads and extracts the FAO capture ZIP to a local cache
load_fao_capture() Reads and joins quantity, country, species, and area tables
clean_country_names() Replaces verbose FAO country names with short/common equivalents
plot_top_species_country() Bar chart of top n species for a country in a given year
plot_species_trend() Time series of catch for one or more species in a country
plot_species_country_comparison() Compare catch of one species across countries (snapshot or trend)
plot_decadal_average() Bar chart of average annual catch per decade for a species in a country
plot_species_global_catch() Stacked area chart of global catch with top n countries highlighted

Usage

Download and load data

library(fishR)

# Downloads to a user cache directory; skips if already present
data_dir <- download_fao_capture()
## Data already available at: /Users/clara/Library/Application Support/org.R-project.R/R/fishr/Capture_2025.1.0
# Returns a joined tibble ready for analysis
data <- load_fao_capture(path = data_dir)

# Optionally add short/common country names
data <- clean_country_names(data)

Top species in a country (single year)

plot_top_species_country(
  data    = data,
  country = "Iceland",
  year    = 2023,
  n       = 10
)

Catch trend over time (single species)

plot_species_trend(
  data    = data,
  country = "Iceland",
  species = "Atlantic cod"
)

Catch trend — multiple species, overlapping lines

plot_species_trend(
  data    = data,
  country = "Iceland",
  species = c("Atlantic cod", "Capelin", "Atlantic herring"),
  facet   = FALSE
)
## Warning in ggplot2::geom_line(colour = if (!multi || facet) colour else NULL, : Ignoring empty
## aesthetic: `colour`.

## Warning in ggplot2::geom_point(colour = if (!multi || facet) colour else NULL, : Ignoring empty
## aesthetic: `colour`.

Catch trend — multiple species, faceted panels

Useful when species have very different catch magnitudes.

plot_species_trend(
  data    = data,
  country = "Iceland",
  species = c("Atlantic cod", "Capelin", "Atlantic herring"),
  facet   = TRUE
)

Compare catch across countries

# Bar chart — top 10 countries for a species in a single year
plot_species_country_comparison(
  data    = data,
  species = "Atlantic cod",
  year    = 2023
)

# Bar chart — specific countries only
plot_species_country_comparison(
  data      = data,
  species   = "Atlantic cod",
  countries = c("Iceland", "Norway", "Canada"),
  year      = 2023
)

# Time series — top 5 countries, overlapping lines
plot_species_country_comparison(
  data    = data,
  species = "Atlantic cod",
  n       = 5
)

# Time series — specific countries, faceted panels
plot_species_country_comparison(
  data      = data,
  species   = "Atlantic cod",
  countries = c("Iceland", "Norway", "Canada"),
  facet     = TRUE
)

Decadal average catch

Useful for identifying long-term structural shifts in catch levels.

plot_decadal_average(
  data    = data,
  country = "Iceland",
  species = "Atlantic cod"
)

Global catch with top countries highlighted

Shows total global catch over time for a species, with the top n countries in distinct colours and all remaining countries aggregated as “Rest of the World” in grey. Useful for reading both overall trends and shifts in country-level contributions simultaneously.

plot_species_global_catch(
  data    = data,
  species = "Skipjack tuna",
  n       = 5
)

Data source

FAO ({{year}}). Global Capture Production. Fisheries and Aquaculture Division. Available at: https://www.fao.org/fishery/en/collection/capture

Status

Early development — functions and data structure may change between versions.

About

Tools to download, clean, and analyse FAO global capture fisheries data. Provides functions to retrieve the FAO capture production dataset, join core reference tables (country, species, and area), and generate simple exploratory summaries and plots.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages