get_species_itis: Extract SPECIES information from CFDBS (SPECIES_ITIS_NE,...

View source: R/get_species_itis.R

get_species_itisR Documentation

Extract SPECIES information from CFDBS (SPECIES_ITIS_NE, table)

Description

Extract a list of speices names, code, market category, etc from the NEFSC SPECIES_ITIS_NE table

Usage

get_species_itis(channel, species = "all", nameType = "common_name")

Arguments

channel

DBI Object. Inherited from DBIConnection-class. This object is used to connect to communicate with the database engine. (see connect_to_database)

species

a specific species code or set of codes. Either numeric or character vector. Defaults to "all" species. Numeric codes (SPECIES_ITIS) are converted to VARCHAR2(33) when creating the sql statement. Character codes are short character strings.

nameType

Character string. either "common_name" (default) or "scientific_name". Determins which type of name to search under

Value

A list is returned:

species

containing the result of the executed $sql statement

sql

containing the sql call

colNames

a vector of the table's column names

The default sql statement "select * from cfdbs.SPECIES_ITIS_NE" is used

Reference

Use the data dictionary (http://nova.nefsc.noaa.gov/datadict/) for field name explanations.

See Also

connect_to_database

Other get functions: get_age_length(), get_anything_sql(), get_areas(), get_gears(), get_landings_length(), get_landings_palmer(), get_landings(), get_locations(), get_ports(), get_species(), get_vessels()

Examples

## Not run: 
# extracts complete species table based on custom sql statement
channel <- connect_to_database(server="name_of_server",uid="individuals_username")
get_species_itis(channel)

# extracts info for cod (164712) 
channel <- connect_to_database(server="name_of_server",uid="individuals_username")
get_species_itis(channel,species=164712)

# extracts info for cod ("COD") 
channel <- connect_to_database(server="name_of_server",uid="individuals_username")
get_species_itis(channel,"cod") or
get_species_itis(channel,"co") or (note also return cockles, calico scallop etc.) 
get_species_itis(channel,"COD")


# extracts info for cod (164712)  and bluefish (168559)
channel <- connect_to_database(server="name_of_server",uid="individuals_username")
sqlStatement <- "select * from cfdbs.species_itis_ne"
get_species_itis(channel,species= c("164712","168559"))

## End(Not run)


andybeet/cfdbs documentation built on Sept. 19, 2023, 9:34 p.m.