Skip to content
fishglobPublic

About

An experimental R package interface to the FishGlob database

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

fishglobr

R-CMD-check

THIS IS AN EXPERIMENTAL DRAFT PROJECT NOT TO BE USED AT THIS STAGE!

fishglobr (perhaps to be renamed to fishglob) is an R package for efficiently downloading, caching, and querying the FishGlob database. FISHGLOB is an international consortium of scientists, experts and data providers who collect, curate, standardize, share and analyse data from scientific bottom trawl surveys.

Installation

You can install the development version of fishglobr like so:

pak::pak("fishglob/fishglobr")

Example

First we load the package and download and install the database locally. We only have to do this once. The data is stored in a local DuckDB database.

library(fishglobr)
install_fishglob_data()
#> Downloading catch ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ |  65 MB/ 65 MB ETA:  0s
#> Downloading haul ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 4.7 MB/4.7 MB ETA:  0s
#> Downloading taxon ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ |  49 kB/ 49 kB ETA:  0s
#> Downloading survey ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 0.7 kB/0.7 kB ETA:  0s
#> Building the local FishGlob DuckDB database
#> FishGlob data are ready in
#> ~/Library/Caches/org.R-project.R/R/fishglobr/fishglob.duckdb
# Find available agency data sources
get_sources()
#> [1] "DATRAS ICES" "DFO"         "IMR"         "NOAA"

# The full list of available species:
spp <- get_scientific_names()
spp[1:5]
#> [1] "Ablennes hians"             "Abudefduf saxatilis"       
#> [3] "Acanthemblemaria"           "Acantholabrus palloni"     
#> [5] "Acantholiparis opercularis"

# All Canary Rockfish data held by DFO
dat <- get_data(
  scientific_name = "sebastes pinniger",
  source = "DFO"
)
nrow(dat)
#> [1] 1106

# All Sebastes data globally from 2000 to 2021
# using a regular expression
dat <- get_data(
  scientific_name = "^sebastes*",
  regex = TRUE,
  year = 2000:2021
)
head(dat[c("scientific_name", "year", "latitude", "longitude", "wgt_cpue")], n = 3)
#>      scientific_name year latitude longitude   wgt_cpue
#> 1 Sebastes fasciatus 2021 42.04747 -67.71460 0.06549118
#> 2 Sebastes fasciatus 2021 41.84667 -68.20291 0.25524769
#> 3 Sebastes fasciatus 2021 42.20143 -66.86743 1.13853904

About

An experimental R package interface to the FishGlob database

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages