A helper function that filters data based on decomposition levels in the "Subtotal" column.
Used internally in get_data_by_var(), get_data_by_dims(), and group_data_by_dims().
process_decomp_level(df, subtotal_level)A filtered data frame based on the specified decomposition level.
A data frame containing a "Subtotal" column.
Character or logical. Determines which values to retain:
"total": Keeps only "TOTAL" values.
"decomposed": Keeps only decomposed values (excludes "TOTAL").
"all": Keeps all rows.
TRUE: Equivalent to "all" (keeps both "TOTAL" and decomposed values).
FALSE: Equivalent to "total" (keeps only "TOTAL" values, removing decomposed components).
Pattawee Puangchit
If subtotal_level = "total", keeps only "TOTAL" values, removing all decomposed components.
If subtotal_level = "decomposed", keeps only decomposed components, removing "TOTAL".
If subtotal_level = "all", keeps both "TOTAL" and decomposed values (no filtering).
If subtotal_level = TRUE (logical), it is equivalent to "all", meaning all values are kept.
If subtotal_level = FALSE (logical), it is equivalent to "total", meaning only "TOTAL" values are kept, and decomposed components are removed.
Filtering is applied only when both "TOTAL" and decomposed values exist.
get_data_by_var, get_data_by_dims, group_data_by_dims