write_factors: Generate a template yaml file to detail metadata for...

View source: R/write_factors.R

write_factorsR Documentation

Generate a template yaml file to detail metadata for attributes that are factors

Description

write_factors creates a template as a yaml file for supplying code definition metadata for factors in a tabular data object that resides in the R environment.

Usage

write_factors(dfname, overwrite = FALSE)

Arguments

dfname

(character) Unquoted name of the R data frame or tibble.

overwrite

(logical) Logical indicating if an existing factors file in the target directory should be overwritten.

Details

The yaml template generated by write_factors includes the field names of all fields defined as factors, and each level of the factor. The template supports the ability to provide a definition for each level. The yaml file is written with the name of the data object in R + "_factors". The create_dataTable function will search for this file when creating a EML dataTable entity.

Value

The name of the file generated is returned, and a template for providing code definition metadata as a yaml file with the file name of the R data object + "_factors.yaml" is created in the working directory.

Note

The user must follow yaml convention to ensure that input is formatted appropriately (e.g., quoting when needed; see https://www.yaml.info/learn/quote.html).

Examples

## Not run: 

 # overwrite existing factors file

 capeml::write_factors(
   dfname    = data_object,
   overwrite = TRUE
 )


## End(Not run)


CAPLTER/capeml documentation built on Oct. 1, 2024, 7:38 a.m.