disaggregate_dt | R Documentation |
Disaggregate data in a data.table object using a mapping. If no weights are given, the value for the aggregated categories is used on the disaggregated ones. If a weight is given, the values from the aggregated categories are distributed according to the weights.
disaggregate_dt(
data,
mapping,
fewcol = "region",
manycol = "iso",
valuecol = "value",
datacols = "data",
weights = NULL,
weightcol = "weight"
)
data |
a data.table. |
mapping |
a mapping between the aggregated categories and their parts. *All* aggregated categories in 'data' have to be part of the mapping. |
fewcol |
name of the column containing aggregated categories. Default is "region". |
manycol |
name of the column containing dis-aggregated categories. Default is "iso". |
valuecol |
name of the column with the actual value to disaggregate, default is 'value'. |
datacols |
index columns that label categories which have to be treated seperately when dis-aggregating with a weight. |
weights |
table with weights for disaggregation, the name of the column with the aggregated categories has to be 'manycol'. If columns (other than the column with the aggregated category) of the 'weights' coincide with columns of the data, the respective columns are considered when joining. |
weightcol |
column with the weights for the dis-aggregation, default is 'weight'. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.