eml_set_reference | R Documentation |
eml_set_reference(element_to_reference, element_to_replace)
element_to_reference |
(list) An EML element to reference. |
element_to_replace |
(list) An EML element to replace with a reference. |
please add references directly instead
This function creates a new object with the same class as element_to_replace
using a reference to element_to_reference
.
Dominic Mullen dmullen17@gmail.com
## Not run:
cn <- dataone::CNode('PROD')
adc <- dataone::getMNode(cn,'urn:node:ARCTIC')
doc <- EML::read_eml(dataone::getObject(adc, 'doi:10.18739/A2S17SS1M'))
# Set the first contact as a reference to the first creator
doc$dataset$contact[[1]] <- eml_set_reference(doc$dataset$creator[[1]],
doc$dataset$contact[[1]])
# This is also useful when we want to set references to a subset of 'dataTable'
or 'otherEntity' objects
# Add a few more objects first to illustrate the use:
doc$dataset$dataTable[[3]] <- doc$dataset$dataTable[[1]]
doc$dataset$dataTable[[4]] <- doc$dataset$dataTable[[1]]
# Add references to the second and third elements only (not the 4th):
for (i in 2:3) {
doc$dataset$dataTable[[i]]$attributeList <- eml_set_reference(
doc$dataset$dataTable[[1]]$attributeList,
doc$dataset$dataTable[[i]]$attributeList)
}
# If we print the entire 'dataTable' list we see elements 2 and 3 have
references while 4 does not.
doc$dataset$dataTable
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.