View source: R/seasonder_specsHandling.R
seasonder_readYAMLSpecs | R Documentation |
This function reads a YAML file containing specifications, handles potential reading errors, and extracts specific information based on a provided path.
seasonder_readYAMLSpecs(file_path, path = rlang::zap())
file_path |
A string. The path to the YAML file. |
path |
A character vector. Represents the path within the YAML file to
access the desired information. For example, to access fields of version V2
of the header, the path would be |
This function provides built-in error handling which aborts execution and logs detailed error messages in case of:
File not found.
Error in reading the YAML content.
The read YAML content is not a list.
No data found for the provided path in the YAML content.
Errors generated are of class "seasonder_read_yaml_file_error"
. For logging and aborting,
this function uses seasonder_logAndAbort
.
A list. The information extracted from the YAML file based on the provided path.
read_yaml
for the underlying YAML reading.
pluck
for the data extraction mechanism used.
# Example: Read the CS header specifications (version V1) from the default specs file
specs_path <- seasonder_defaultSpecsFilePath("CS")
result <- seasonder_readYAMLSpecs(specs_path, c("header", "V1"))
str(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.