seasonder_readYAMLSpecs {SeaSondeR}R Documentation

Read Specifications from a YAML File

Description

This function reads a YAML file containing specifications, handles potential reading errors, and extracts specific information based on a provided path.

Usage

seasonder_readYAMLSpecs(file_path, path = rlang::zap())

Arguments

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 c("header", "versions", "V2").

Details

This function provides built-in error handling which aborts execution and logs detailed error messages in case of:

Errors generated are of class "seasonder_read_yaml_file_error". For logging and aborting, this function uses seasonder_logAndAbort.

Value

A list. The information extracted from the YAML file based on the provided path.

See Also

read_yaml for the underlying YAML reading.

pluck for the data extraction mechanism used.

Examples

# 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)

[Package SeaSondeR version 0.2.8 Index]