Package 'icesVocab'

Title: ICES Vocabularies Database Web Services
Description: R interface to access the RECO POX web services of the ICES (International Council for the Exploration of the Sea) Vocabularies database <https://vocab.ices.dk/services/POX.aspx>.
Authors: Colin Millar [aut, cre], Arni Magnusson [aut]
Maintainer: Colin Millar <[email protected]>
License: GPL-3
Version: 1.2.1
Built: 2024-10-31 21:07:23 UTC
Source: https://github.com/ices-tools-prod/icesVocab

Help Index


Vocabularies Database Web Services

Description

R interface to access the web services of the ICES Vocabularies database of reference codes.

Details

Get full tables:

getCodeTypeList all code code types
getCodeList codes of a given type
getCodeDetail details for a given code

Look up specific codes:

findAphia species code

Author(s)

Colin Millar and Arni Magnusson.

References

ICES Vocabularies database: http://vocab.ices.dk.

ICES Vocabularies web services: http://vocab.ices.dk/services/POX.aspx.


Find Aphia Code

Description

Look up Aphia code for a given species.

Usage

findAphia(species, latin = FALSE, regex = FALSE, full = FALSE)

Arguments

species

the species name, either in English (default) or Latin.

latin

whether the species name is in Latin.

regex

whether to match the species name as a regular expression.

full

whether to return a data frame with all species columns.

Details

Species name matches are case-insensitive.

Value

A vector of Aphia codes (default) or a data frame if full is TRUE.

Author(s)

Arni Magnusson.

See Also

getCodeList can be used to get all Aphia codes; see example on that help page.

icesVocab-package gives an overview of the package.

Examples

findAphia("cod")
findAphia("Gadus morhua", latin = TRUE)

# Multiple matches
findAphia(c("cod", "haddock", "saithe"))

# Regular expressions
findAphia("ray", regex = TRUE, full = TRUE)
findAphia("Sebastes", latin = TRUE, regex = TRUE, full = TRUE)

Find a Key

Description

Look up a key for a given code and code type.

Usage

findCode(code_type, code, regex = TRUE, full = FALSE)

Arguments

code_type

a search string for a code type, e.g. SpecWorms, or simply worms.

code

a search string for a code, e.g. a species name, cod, or ship name, Clupea.

regex

whether to match as a regular expression.

full

whether to return a data frame.

Details

Matches are case-insensitive.

Value

A vector of keys (default) or a data frame if full is TRUE.

See Also

getCodeList can be used to get all code types; see example on that help page.

icesVocab-package gives an overview of the package.

Examples

findCode("aphia", "cod")

# Multiple matches
findCode("aphia", c("cod", "haddock", "saithe"), full = TRUE)

findCodeType("ship", full = TRUE)
findCode("ship", "clupea", full = TRUE)

Find a Key

Description

Find a lookup key corresponding to a code type.

Usage

findCodeType(code, date = NULL, regex = TRUE, full = FALSE)

Arguments

code

a code name, e.g. Gear Type, or DATRAS to find all DATRAS related codes.

date

restrict output to code types modified after a given date in yyyy-mm-dd format, e.g. "2010-12-01"

regex

whether to match the stock name as a regular expression.

full

whether to return a data frame with all stock list columns.

Value

A vector of keys (default) or a data frame if full is TRUE.

See Also

getCodeTypeList gets a list of code types.

icesVocab-package gives an overview of the package.

Examples

findCodeType("worms")

findCodeType("DATRAS", full = TRUE)

findCodeType("DATRAS", full = TRUE, date = "2010-01-01")

Get Details

Description

Get details for a given code.

Usage

getCodeDetail(code_type, code)

Arguments

code_type

the code type, e.g. SpecWoRMS.

code

the code, e.g. 101170.

Value

A data frame.

See Also

getCodeTypeList and getCodeList get code types and codes of a given type.

icesVocab-package gives an overview of the package.

Examples

# Species code 101170 - Myxine glutinosa
getCodeDetail("SpecWoRMS", 101170)

# find details of Haddock using the aphia ID
findCode("species", "haddock", full = TRUE)

getCodeDetail("SpecWoRMS", 126437)

# get info for had-34
getCodeDetail("ICES_StockCode", "had-34")

Get Codes

Description

Get codes of a given code type.

Usage

getCodeList(code_type, date = NULL)

Arguments

code_type

the code type, e.g. SpecWoRMS.

date

restrict output to codes modified after a given date in yyyy-mm-dd format, e.g. "2010-12-01".

Value

A data frame.

See Also

getCodeTypeList and getCodeDetail get code types and code details.

findCodeType and findAphia provide support for searching the code type and code lists.

icesVocab-package gives an overview of the package.

Examples

# Aphia Species codes
findCodeType("aphia", full = TRUE)
codes <- getCodeList("SpecWoRMS")
head(codes)

findAphia("cod", full = TRUE)

Get Types

Description

Get all code types. Mainly useful as a reminder of what code types are available.

Usage

getCodeTypeList(date = NULL)

Arguments

date

restrict output to code types modified after a given date in yyyy-mm-dd format, e.g. "2010-12-01"

Value

A data frame.

See Also

getCodeList and getCodeDetail get codes of a given type and code details.

findCodeType searches for a code types based on a search string.

icesVocab-package gives an overview of the package.

Examples

# Find code type for World Register of Marine Species (WoRMS)
types <- getCodeTypeList()
types[grep("worms", tolower(types$Description)),]

findCodeType("worms", full = TRUE)

# The code type "SpecWoRMS" can be used when calling getCodeList()

Get Links Between Two Code Types

Description

Find parent or child linkages between the codes of two code types.

Usage

linkCodes(code_type, linked_code_type, link_type = c("children", "parent"))

Arguments

code_type

the species name, either in English (default) or Latin.

linked_code_type

whether the species name is in Latin.

link_type

whether to match the species name as a regular expression.

Value

A data frame.

Author(s)

Colin Millar.

See Also

icesVocab-package gives an overview of the package.

Examples

linkCodes("Pargroup", "PARAM", "children")