Learn R Programming

rfishbase (version 0.2-2)

which_fish: which_fish is the the generic search function for fishbase a variety of description types

Description

which_fish is the the generic search function for fishbase a variety of description types

Usage

which_fish(keyword, using = c("trophic", "habitat", "lifecycle", "morphology",
  "diagnostic", "distribution", "ScientificName", "Genus", "Family", "Class",
  "Order", "size", "all"), fish.data = NULL, path = NULL)

Arguments

keyword
pattern to be used by grep
using
the type of search, one of: "trophic", "habitat", "lifecycle", "morphology","diagnostic", "distribution", "ScientificName", "Genus", "Family", "Class", "Order", or "size" See examples.
fish.data
the fishbase database fish.data or a subset
path
to cached copy of fishbase (optional, defaults to copy in package).

Value

  • a logical vector of length(fish.data) indicating the matches.

See Also

fish_names

Examples

Run this code
data(fishbase)
invert <- which_fish("invertebrate|mollusk", using="trophic", fish.data)
fish_names(fish.data[invert])
sex_swap <- which_fish("change sex", using="lifecycle", fish.data)
africa <- which_fish("Africa", using="distribution", fish.data)
## recall we can sub-set
fish_names(fish.data[africa & sex_swap])
reef <- which_fish("reef", "habitat", fish.data)
redfish  <- which_fish("red ", "diagnostic", fish.data)
bluefish  <- which_fish("blue ", "diagnostic", fish.data)
sum(redfish) > sum(bluefish)

Run the code above in your browser using DataLab