Access specific elements
The eml_get()
function is a powerful tool for exploring EML (more on that here ). It takes any chunk of EML and returns all instances of the element you specify. Note: you’ll have to specify the element of interest exactly, according to the spelling/capitalization conventions used in EML. Here are some examples:
doc <- read_eml(system.file("example-eml.xml", package = "arcticdatautils"))
eml_get(doc, "creator")
individualName:
givenName: Bryce
surName: Mecum
organizationName: National Center for Ecological Analysis and Synthesis
eastBoundingCoordinate: '-134'
northBoundingCoordinate: '59'
southBoundingCoordinate: '57'
westBoundingCoordinate: '-135'
'':
function: download
url: ecogrid://knb/urn:uuid:89bec5d0-26db-48ac-ae54-e1b4c999c456
'': ecogrid://knb/urn:uuid:89bec5d0-26db-48ac-ae54-e1b4c999c456
eml_get_simple()
is a simplified alternative to eml_get()
that produces a list of the desired EML element.
To find an eml element you can use either a combination of which_in_eml
from the arcticdatautils
package or eml_get_simple
and which
to find the index in an EML list. Use which ever workflow you see
fit.
An example question you may have: Which creators have a surName “Mecum”?
Example using which_in_eml
:
Example using eml_get_simple
and which
: