eml_get_simple: Get a simple list output from EML::eml_get()

View source: R/eml.R

eml_get_simpleR Documentation

Get a simple list output from EML::eml_get()

Description

This function is a convenience wrapper around EML::eml_get() which returns the output as a simple list as opposed to an object of type emld by removing the attributes and context from the object. If an element containing children is returned all of it's children will be flattened into a named character vector. This function is best used to extract values from elements that have no children.

Usage

eml_get_simple(doc, element)

Arguments

doc

(list) An EML object or child/descendant object

element

(character) Name of the element to be extracted. If multiple occurrences are found, will extract all.

Value

out (vector) A list of values contained in element given

Examples

## Not run: 
cn <- dataone::CNode('PROD')
adc <- dataone::getMNode(cn,'urn:node:ARCTIC')

doc <- EML::read_eml(dataone::getObject(adc, 'doi:10.18739/A2S17SS1M'))

datatable_names <- eml_get_simple(doc$dataset$dataTable, element = "entityName")

## End(Not run)


NCEAS/arcticdatautils documentation built on Aug. 28, 2023, 12:10 p.m.