Function to aggregate the information from a set of strata

aggrStrata(strata, nvar, vett, censiti, dominio)

Arguments

strata

name of the dataframe containing the strata to be aggregated.

nvar

number of target variables Y

vett

vector of integers of the same length of the dimension of the 'strata' dataframe indicating how the strata must be aggregated.

censiti

flag indicating if the strata are take-all (=1) or not (=0)

dominio

variable in the strata indicating the domain level

Value

a dataframe containing the aggregated strata

Details

Be aware that this function is applicable only to strata of a same domain level

Examples

data(beat.example)
vett <- c(rep(1,5),rep(2,5),rep(3,7))
R2BEAT:::aggrStrata(strata,vett,nvar=2,dominio="DOM1",censiti=0)
#>   STRATO         M1         M2        S1        S2       N DOM1 COST CENS
#> 1      1 0.02239026 0.01617112 0.1479490 0.1261332 3667707 DOM1    1    0
#> 2      2 0.04316552 0.01312444 0.2032293 0.1138076 1962115 DOM1    1    0
#> 3      3 0.04478988 0.01604908 0.2068422 0.1256642 7396417 DOM1    1    0