R/template_arguments.R
template_arguments.Rd
Initialize the full list of possible inputs to EMLassemblyline
functions (i.e. function arguments, metadata templates, and data
objects). This enables bridging of upstream metadata and data sources
(e.g. metabases, databases, Excel files, web forms, etc.).
template_arguments(
path = NULL,
data.path = NULL,
data.table = NULL,
other.entity = NULL,
sep = NULL,
empty = FALSE
)
(character) Path to the directory containing EMLassemblyline
metadata templates.
(character) Path to the directory containing data.table
and
other.entity
data objects.
(character) File names of data tables. If more than one, then supply as
a vector (e.g. data.table = c('decomp.csv', 'nitrogen.csv')
).
(character) File names of other entity data objects. If more than one,
then supply as a vector (e.g.
other.entity = c('ancillary_data.zip', 'processing_and_analysis.R')
).
(character) Data table field delimiter. Use this if this function fails
to read your data.table
.
(logical) Initialize the output with a set of empty metadata templates? This option is useful when wanting to transfer metadata directly into the template files without having to call the templating functions.
(named list) A list of all EMLassemblyline
arguments, specified
metadata templates and data objects.
Character encoding in tabular metadata templates is converted to UTF-8
via enc2utf8()
. Characters in TextType metadata templates are not
yet converted. Note: This may lead to an inaccuracy and disconnect
between values in the data objects and what is reported in the EML (e.g.
a categorical variable listed in the EML may not be the same as it's
corresponding value in the data object). To reduce the chance of this,
warnings are issued if the input data object from which the metadata was
extracted is not UTF-8 encoded.
# Output arguments and empty versions of metadata templates
r <- template_arguments(empty = TRUE)
# Output arguments, completed versions of metadata templates, and data objects
mydir <- file.copy(
system.file('/examples/pkg_260', package = 'EMLassemblyline'),
tempdir(),
recursive = TRUE)
setwd(paste0(tempdir(), "/pkg_260"))
r <- template_arguments(
path = "./metadata_templates",
data.path = "./data_objects",
data.table = c("decomp.csv", "nitrogen.csv"),
other.entity = c("ancillary_data.zip", "processing_and_analysis.R"))