insert_additional_metadata: Insert additional metadata into an EML document

View source: R/insert_additional_metadata.R

insert_additional_metadataR Documentation

Insert additional metadata into an EML document

Description

Sometime, for various reasons, additional metadata just needs to be inserted into EML documents manually. This is for quickly doing that in R. The function adds a snippet of plain text EML after a specified line number in the EML file. A pattern can also be defined for grep-ing the line number to append to (e.g. additional metadata needs to be inserted after a specific line). The defaults reflect BLE's need to add a snippet to aid replication of metadata to the Arctic Data Center that for a certain reason cannot be added via our normal means (the EML R package).

Usage

insert_additional_metadata(file, pattern = NULL, addition = NULL, after)

Arguments

file

(character) Path to EML file. Function will also write to this same file.

pattern

(character) Grep pattern. grep() will be called on the contents of the file, and the first match will be used. Defaults to "</dataset>".

addition

(character) Plain text of EML snippet to insert. Defaults to an "additionalMetadata" node pertaining to replication I won't paste here.

after

(numeric) A line number to append after. Only comes into play if pattern is not found. No defaults.

Value

Nothing in the R environment, but a file with the snippet inserted where specified. File will remain the same


atn38/BLE-LTER-utils documentation built on March 4, 2024, 9:13 p.m.