This function updates the `var` column in the `structure` component of the `trees` list, replacing dummy variable names derived from factor variables with their original factor variable names.

combineDummy(trees)

Arguments

trees

A list containing at least two components: `data` and `structure`. `data` should be a dataframe, and `structure` a dataframe that includes a `var` column.

Value

The modified `trees` list with updated `var` column entries in `trees$structure`.

Details

The function first identifies factor variables in `trees$data`, then checks each entry in `trees$structure$var` for matches with these factor variables. If a match is found, indicating a dummy variable, the entry is replaced with the original factor variable name.

Examples

if (FALSE) {
df_trees <- extractTreeData(model = my_model, data = my_data)
combined_trees <- combineDummy(trees = df_trees)
}