MyNixOS website logo
Description

'Programmatic Interface to the 'openfisheries.org' API'.

A programmatic interface to 'openfisheries.org'. This package is part of the 'rOpenSci' suite (http://ropensci.org).

Linux: travis
Windows: Build status
CRAN_downloads

rfisheries

beta logo

This package provides programmatic access to the openfisheriesAPI. Open Fisheries is a platform that aggregates global fishery data and currently offers global fish capture landings from 1950 onwards (more data coming soon). Read more about that effort here.

Installing

install.packages("rfisheries")

or grab the development version. To install this version you'll need the devtools package first.

# install.packages('devtools')
devtools::install_github('ropensci/rfisheries')

Usage

Package currently provides three basic functions. Landings data can be obtained by calling landings()

library(rfisheries)
of_landings()
   catch year
1 19234925 1950
2 21691884 1951
3 23653027 1952
4 24076599 1953
5 25988306 1954
6 27510779 1955
...

# To get country specific data, provide a iso3c country code

of_landings(country = "USA")
    catch year
1 2629961 1950
2 2452312 1951
3 2472565 1952
4 2534099 1953
5 2596039 1954
6 2621021 1955
...

# To get species specific landings, provide the correct a3 code for the required species.

of_landings(species = "SKJ")
   catch year
1 162750 1950
2 185848 1951
3 157411 1952
4 164629 1953
5 210702 1954
6 189223 1955
...

If you don't have know the correct species or country codes, you can get a complete list with the following two functions.

of_species_codes()
         scientific_name   taxocode a3_code isscaap
1     Petromyzon marinus 1020100101     LAU      25
2   Lampetra fluviatilis 1020100201     LAR      25
3    Lampetra tridentata 1020100202     LAO      25
4 Ichthyomyzon unicuspis 1020100401     LAY      25
5    Eudontomyzon mariae 1020100501     LAF      25
6      Geotria australis 1020100701     LAE      25
             english_name
1             Sea lamprey
2           River lamprey
3         Pacific lamprey
4          Silver lamprey
5 Ukrainian brook lamprey
6         Pouched lamprey
...

# Similarly you can get a full list of country codes
of_country_codes()
         country iso3c
1    Afghanistan   AFG
2        Albania   ALB
3        Algeria   DZA
4 American Samoa   ASM
5        Andorra   AND
6         Angola   AGO

Example: Compare landings from multiple countries

library(plyr)
library(rfisheries)
countries <- of_country_codes()
# let's take a small subset, say 5 random countries
c_list <- countries[sample(nrow(countries), 5),]$iso3c
# and grab landings data for these countries
results <- ldply(c_list, function(x) {
    df <- of_landings(country = x)
    df$country  <-  x
    df
}, .progress = 'text')

You can easily compare these results

library(ggplot2)
ggplot(results, aes(year, catch, group = country, color = country)) + geom_line()

multiple countries

Similarly you can get landings data for multiple species. As the API evolves, we'll update the package and get it to CRAN at some point.

Creative interactive charts

Using the rCharts library, it's easy to create interactive plots. Here's a quick example.

library(rfisheries)
library(rCharts)
cod <- of_landings(species = "COD")
cod$date <- paste0(cod$year, "-01", "-01")
cod_plot <- mPlot(x = "date", y = "catch", type = "Line", data = cod)
cod_plot$set(pointSize = 0, lineWidth = 4)
cod_plot

Please report any issues or bugs.

License: MIT

This package is part of the rOpenSci project.

To cite package ‘rfisheries’ in publications use:

  Karthik Ram, Carl Boettiger and Andrew Dyck (2013). rfisheries: R
  interface for fisheries data. R package version 0.1.
  http://CRAN.R-project.org/package=rfisheries

A BibTeX entry for LaTeX users is

  @Manual{,
    title = {rfisheries: R interface for fisheries data},
    author = {Karthik Ram and Carl Boettiger and Andrew Dyck},
    year = {2013},
    note = {R package version 0.1},
    url = {http://CRAN.R-project.org/package=rfisheries},
  }

footer

Metadata

Version

0.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows