All Projects → ropensci → rfisheries

ropensci / rfisheries

Licence: other
package for interacting with fisheries databases at openfisheries.org

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to rfisheries

eia
An R package wrapping the US Energy Information Administration open data API.
Stars: ✭ 38 (+58.33%)
Mutual labels:  open-data, r-package
DoReMIFaSol
Téléchargement des données sur le site de l'Insee
Stars: ✭ 25 (+4.17%)
Mutual labels:  open-data, r-package
Ckanr
R client for the CKAN API
Stars: ✭ 91 (+279.17%)
Mutual labels:  open-data, r-package
arcdiagram
R package arcdiagram
Stars: ✭ 75 (+212.5%)
Mutual labels:  r-package
mizer
Multi-species size-based ecological modelling in R
Stars: ✭ 30 (+25%)
Mutual labels:  fisheries
otv2-platform
An overview of the entire Open Traffic v2 platform and its components
Stars: ✭ 89 (+270.83%)
Mutual labels:  open-data
rcpptoml
Rcpp Bindings to C++ parser for TOML files
Stars: ✭ 26 (+8.33%)
Mutual labels:  r-package
MetQy
Repository for R package MetQy (read related publication here: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6247936/)
Stars: ✭ 17 (-29.17%)
Mutual labels:  r-package
PackageReviewR
R Package 📦 to review 🔍 R 📦s
Stars: ✭ 18 (-25%)
Mutual labels:  r-package
rcppcnpy
Rcpp bindings for NumPy files
Stars: ✭ 24 (+0%)
Mutual labels:  r-package
disaster-crawler
Data sources from Kimono currently unavailable
Stars: ✭ 13 (-45.83%)
Mutual labels:  open-data
bhamtech
A community-currated collection of tech resources, projects, and other things related for Birmingham, AL
Stars: ✭ 23 (-4.17%)
Mutual labels:  open-data
tsgam
Functions for using GAMs to model time series
Stars: ✭ 30 (+25%)
Mutual labels:  r-package
cbsodata
Unofficial Statistics Netherlands (CBS) opendata API client for Python
Stars: ✭ 32 (+33.33%)
Mutual labels:  open-data
healthyR
Hospital Data Analysis Workflow Tools
Stars: ✭ 21 (-12.5%)
Mutual labels:  r-package
vosonSML
R package for collecting social media data and creating networks for analysis.
Stars: ✭ 65 (+170.83%)
Mutual labels:  r-package
sparklygraphs
Old repo for R interface for GraphFrames
Stars: ✭ 13 (-45.83%)
Mutual labels:  r-package
xaringanBuilder
An R package for building xaringan slides into multiple outputs, including html, pdf, png, gif, pptx, and mp4.
Stars: ✭ 157 (+554.17%)
Mutual labels:  r-package
unrtf
Wrapper for 'unrtf' utility to extract text from RTF documents
Stars: ✭ 14 (-41.67%)
Mutual labels:  r-package
geostan
Bayesian spatial analysis
Stars: ✭ 40 (+66.67%)
Mutual labels:  r-package

Linux: travis
Windows: Build status
CRAN_downloads

rfisheries

beta logo

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.

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].