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 |
R interface to access the web services of the ICES Vocabularies database of reference codes.
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 |
Colin Millar and Arni Magnusson.
ICES Vocabularies database: http://vocab.ices.dk.
ICES Vocabularies web services: http://vocab.ices.dk/services/POX.aspx.
Look up Aphia code for a given species.
findAphia(species, latin = FALSE, regex = FALSE, full = FALSE)
findAphia(species, latin = FALSE, regex = FALSE, full = FALSE)
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. |
Species name matches are case-insensitive.
A vector of Aphia codes (default) or a data frame if full is TRUE.
Arni Magnusson.
getCodeList
can be used to get all Aphia codes; see example on
that help page.
icesVocab-package
gives an overview of the package.
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)
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)
Look up a key for a given code and code type.
findCode(code_type, code, regex = TRUE, full = FALSE)
findCode(code_type, code, regex = TRUE, full = FALSE)
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. |
Matches are case-insensitive.
A vector of keys (default) or a data frame if full is TRUE.
getCodeList
can be used to get all code types; see example on
that help page.
icesVocab-package
gives an overview of the package.
findCode("aphia", "cod") # Multiple matches findCode("aphia", c("cod", "haddock", "saithe"), full = TRUE) findCodeType("ship", full = TRUE) findCode("ship", "clupea", full = TRUE)
findCode("aphia", "cod") # Multiple matches findCode("aphia", c("cod", "haddock", "saithe"), full = TRUE) findCodeType("ship", full = TRUE) findCode("ship", "clupea", full = TRUE)
Find a lookup key corresponding to a code type.
findCodeType(code, date = NULL, regex = TRUE, full = FALSE)
findCodeType(code, date = NULL, regex = TRUE, full = FALSE)
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. |
A vector of keys (default) or a data frame if full is TRUE.
getCodeTypeList
gets a list of code types.
icesVocab-package
gives an overview of the package.
findCodeType("worms") findCodeType("DATRAS", full = TRUE) findCodeType("DATRAS", full = TRUE, date = "2010-01-01")
findCodeType("worms") findCodeType("DATRAS", full = TRUE) findCodeType("DATRAS", full = TRUE, date = "2010-01-01")
Get details for a given code.
getCodeDetail(code_type, code)
getCodeDetail(code_type, code)
code_type |
the code type, e.g. SpecWoRMS. |
code |
the code, e.g. 101170. |
A data frame.
getCodeTypeList
and getCodeList
get code types
and codes of a given type.
icesVocab-package
gives an overview of the package.
# 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")
# 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 of a given code type.
getCodeList(code_type, date = NULL)
getCodeList(code_type, date = NULL)
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". |
A data frame.
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.
# Aphia Species codes findCodeType("aphia", full = TRUE) codes <- getCodeList("SpecWoRMS") head(codes) findAphia("cod", full = TRUE)
# Aphia Species codes findCodeType("aphia", full = TRUE) codes <- getCodeList("SpecWoRMS") head(codes) findAphia("cod", full = TRUE)
Get all code types. Mainly useful as a reminder of what code types are available.
getCodeTypeList(date = NULL)
getCodeTypeList(date = NULL)
date |
restrict output to code types modified after a given date in yyyy-mm-dd format, e.g. "2010-12-01" |
A data frame.
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.
# 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()
# 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()
Find parent or child linkages between the codes of two code types.
linkCodes(code_type, linked_code_type, link_type = c("children", "parent"))
linkCodes(code_type, linked_code_type, link_type = c("children", "parent"))
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. |
A data frame.
Colin Millar.
icesVocab-package
gives an overview of the package.
linkCodes("Pargroup", "PARAM", "children")
linkCodes("Pargroup", "PARAM", "children")