The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
This package provides programmatic access to the openfisheries API. 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.
install.packages("rfisheries")
or grab the development version. To install this version you’ll need
the devtools
package first.
# install.packages('devtools')
::install_github('ropensci/rfisheries') devtools
Package currently provides three basic functions. Landings data can
be obtained by calling landings()
library(rfisheries)
of_landings()
catch year1 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 year1 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 year1 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 isscaap1 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_name1 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 iso3c1 Afghanistan AFG
2 Albania ALB
3 Algeria DZA
4 American Samoa ASM
5 Andorra AND
6 Angola AGO
library(plyr)
library(rfisheries)
<- of_country_codes()
countries # let's take a small subset, say 5 random countries
<- countries[sample(nrow(countries), 5),]$iso3c
c_list # and grab landings data for these countries
<- ldply(c_list, function(x) {
results <- of_landings(country = x)
df $country <- x
df
df.progress = 'text') },
You can easily compare these results
library(ggplot2)
ggplot(results, aes(year, catch, group = country, color = country)) + geom_line()
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.
Using the rCharts library, it’s easy to create interactive plots. Here’s a quick example.
library(rfisheries)
library(rCharts)
<- of_landings(species = "COD")
cod $date <- paste0(cod$year, "-01", "-01")
cod<- mPlot(x = "date", y = "catch", type = "Line", data = cod)
cod_plot $set(pointSize = 0, lineWidth = 4)
cod_plot 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:
Dyck (2013). rfisheries: R
Karthik Ram, Carl Boettiger and Andrew for fisheries data. R package version 0.1.
interface ://CRAN.R-project.org/package=rfisheries
http
for LaTeX users is
A BibTeX entry
@Manual{,
= {rfisheries: R interface for fisheries data},
title = {Karthik Ram and Carl Boettiger and Andrew Dyck},
author = {2013},
year = {R package version 0.1},
note = {http://CRAN.R-project.org/package=rfisheries},
url }
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.