movebank_get_vocabulary {move2} | R 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 |
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. |
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.
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()