Flattens a nested list of models and renames the elements by combining the outer and inner list names.
flatten_and_rename_models(models)
A flattened list with each element renamed according to its original outer and inner list names.
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)"
.
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.