Learn R Programming

fastml (version 0.5.0)

flatten_and_rename_models: Flatten and Rename Models

Description

Flattens a nested list of models and renames the elements by combining the outer and inner list names.

Usage

flatten_and_rename_models(models)

Value

A flattened list with each element renamed according to its original outer and inner list names.

Arguments

models

A nested list of models. The outer list should have names. If an inner element is a named list, the names will be combined with the outer name in the format "outer_name (inner_name)".

Details

The function iterates over each element of the outer list. For each element, if it is a list with names, the function concatenates the outer list name and the inner names using paste0 and setNames. If an element is not a list or does not have names, it is included in the result without modification.