compress {segregation} | R Documentation |
Compresses a data matrix based on mutual information (segregation)
Description
Given a data set that identifies suitable neighbors for merging, this function will merge units iteratively, where in each iteration the neighbors with the smallest reduction in terms of total M will be merged.
Usage
compress(
data,
group,
unit,
weight = NULL,
neighbors = "local",
n_neighbors = 50,
max_iter = Inf
)
Arguments
data |
A data frame. |
group |
A categorical variable
contained in |
unit |
A categorical variable
contained in |
weight |
Numeric. Only frequency weights are allowed.
(Default |
neighbors |
Either a data frame or a character. If data frame, then
it needs exactly two columns, where each row identifies
a set of "neighbors" that may be merged.
If "local", considers the |
n_neighbors |
Only relevant if |
max_iter |
Maximum number of iterations (Default |
Value
Returns a data.table.