Learn R Programming

dietr (version 1.1.6-1)

ConvertFishbaseDiet: Converts FishBase/SealifBase diet data obtained from rfishbase for use with dietr

Description

This converts diet data from rfishbase into a format usable with dietr.

Usage

ConvertFishbaseDiet(ExcludeStage = NULL)

Value

a list of length two, with two data frames. One containing the re-formatted diet items and their contributions and one containing the Taxonomy with species names.

Arguments

ExcludeStage

a character vector, indicating which life stages to exclude. Must match stage names given by rfishbase (i.e. larvae, rec./juveniles, juv./adults, adults).

Author

Samuel Borstein

Details

As of rfishbase 3.0, the package handles returning diet data differently than in previous versions. As currently implemented, rfishbase returns two different unjoined diet tables, one with the actual diet items and their percent contribution in the diet, and another that has the metadata for the diet record. This unfortunately is a difficult format to work with and easily extract out species of interest. Additionally, in previous versions you could specify species names or numbers and only return those of interest, the only function options in the current version are specifying a server. As such, if the function is run, it will return all diet data on the site, requiring users to subset out those of interest for them. We have implemented in this function a way to join the tables for use as well as filter based on life history stage (if necessary).

Examples

Run this code
if (FALSE) { # interactive()
# \donttest{
#Convert Fishbase Diet Data and exclude juvenile and larval records
my.diets <- try(ConvertFishbaseDiet(ExcludeStage=c("recruits/juv.","larvae")))
  if (!"try-error" %in% class(my.diets)){
    my.diets
 }
# }
}

Run the code above in your browser using DataLab