Transform a dataframe to a nested lists structure (i.e. hierarchical).
df_to_nest(data, step_cols, nodes_data = NULL, count_col = "value",
value_cols = NULL, agg_function = sum, na_behavior = "rm")
The data frame to convert to the nested structure. It needs to have several comlumns, each ones account for a given step
vector containing the names of the columns which should be used as steps. The vector should be ordered. ex: c('step1','step2','step3')
A named list to add addition informations to each nodes
Number of occurences in this path (succesion of steps). Default: NULL
Names of the other columns to keep. Default: NULL
aggregation function to be applied to value_cols.Ex: mean, sum. Default: sum. Weighted version can also be used, the weighting will be done using the counting variable
How to deal with missing data ?
A data.table with the columns specified in count_col, value_cols and one column per step in the path