movebank_get_vocabulary: Retrieve information from the movebank vocabulary describing...

View source: R/movebank_get_vocabulary.R

movebank_get_vocabularyR Documentation

Retrieve information from the movebank vocabulary describing the columns

Description

Retrieve information describing the columns from the 'Movebank Attribute Dictionary'

Usage

movebank_get_vocabulary(
  labels,
  xml = "http://vocab.nerc.ac.uk/collection/MVB/current/",
  omit_deprecated = TRUE,
  return_type = c("definition", "list", "xml", "uri")
)

Arguments

labels

Either a character vector with the column names to look up or a move2 object from which the column names will be extracted. Matches are made both based on the preferred label and the alternative label in the vocabulary. If no argument is provided all movebank terms are returned

xml

Either a connection to the movebank vocabulary xml, a path to the vocabulary file or an url where it can be downloaded. The later is the default. By downloading the xml yourself the function will speed up and become independent of an internet connection being available.

omit_deprecated

If concepts are marked deprecated they are omitted from the set of possible labels to match.

return_type

A character scalar identifying the desired return type, see details for more information on the specific types.

Details

This function can return data in several formats (see return_type argument):

  • definition A named text vector with the description of the term.

  • list A list with all information for each term.

  • xml A xml_node with the definition.

  • uri A link to the full definitions page.

In case labels matches both a preferred and an alternative label the term with the preferred label is returned.

Value

A named list of the selected return_type, note that if deprecated are not omitted duplicated names can occur.

Examples


## the names of all terms used in movebank
movebank_get_vocabulary() |>
  names()
## retrieve one variable
movebank_get_vocabulary("gps hdop")
## Count the units used in movebank
movebank_get_vocabulary() |>
  unlist() |>
  grep(pattern = "Units:", value = TRUE) |>
  sub(replacement = "", pattern = ".*Units: ") |>
  sub(replacement = "", pattern = "; .*") |>
  table() |>
  sort()
## different return types:
movebank_get_vocabulary("light-level", return_type = "definition")
movebank_get_vocabulary("light-level", return_type = "xml")
movebank_get_vocabulary("light-level", return_type = "uri")
movebank_get_vocabulary("light-level", return_type = "list")
## get definitions of all column names of a move2 object, the conversion
## to a list is for better printing
data <- mt_read(mt_example())
movebank_get_vocabulary(data) |>
  as.list()


move2 documentation built on April 4, 2025, 12:24 a.m.