Convenience functions for unnesting model columns (supports both if regression is stored nested or unnested - see run_regression for details).

unnest_model_column(
  dt,
  model_column,
  model_params = model_params,
  nested_model = FALSE,
  select = everything(),
  keep_remaining_nested_data = FALSE,
  keep_other_list_data = FALSE
)

Arguments

model_column

name of the model column to unnest

model_params

name of the model params column that holds all the other model columns (if nested_model = TRUE)

nested_model

whether the model is nested, if TRUE, must also provide model_params

select

which columns to unnest - use c(...) to select multiple, supports all select syntax including renaming columns. Includes all columns by default (i.e. unnests an entire nested data frame).

keep_remaining_nested_data

whether to keep any remaining parts of the partially unnested data (irrelevant if select = everything())

keep_other_list_data

keep other list data columns (e.g. other data or model columns)