Skip to contents

Safely extracts a parameter from configuration with default fallback.

Usage

get_config_param(config, ..., .default = NULL)

Arguments

config

Configuration list

...

Path to parameter (passed to purrr::pluck)

.default

Default value if parameter not found

Value

Parameter value or default

Examples

# Simple nested parameter extraction
config <- list(model = list(params = list(lr = 0.01)))
lr <- get_config_param(config, "model", "params", "lr", .default = 0.001)
print(lr)  # 0.01
#> [1] 0.01

# With default fallback
missing <- get_config_param(config, "model", "missing", .default = "default")
print(missing)  # "default"
#> [1] "default"