View source: R/write_attributes.R
write_attributes | R Documentation |
write_attributes creates a template as a yaml file for supplying attribute metadata for a tabular data object that resides in the R environment.
write_attributes(dfname, overwrite = FALSE, return_type = "yaml")
dfname |
(character) The quoted or unquoted name of the data object (data frame, tibble, simple feature). |
overwrite |
(logical) Logical indicating if an existing attributes file in the target directory should be overwritten. |
return_type |
(character) Quoted designator indicating the value returned as either a attributes template yaml file (return_type = "yaml", the default) or a list of entity attributes (return_type = "attributes") constructed from the data entity, the latter primarily as a helper feature for updating an existing attributes file. |
The yaml template generated by write_attributes includes the field names of the data entity. The number type, column class (e.g., factor, numeric), minimum and maximum values (if numeric), and missing value code and explanation (if provided) for each field. The template supports input of format string, unit, definition, and attribute definition. The yaml file is written with the name of the data object in R + "_attrs". The create_dataTable function will search for this file will creating a EML dataTable entity.
The name of the file generated is returned, and a template for providing attribute metadata as a yaml file with the file name of the R data object + "_attrs.yaml" is created in the working directory.
## Not run:
# create attributes file for mycars data object, overwriting an existing
# file if one exists
mycars <- head(mtcars)
capeml::write_attributes(
dfname = mycars,
overwrite = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.