R/BIFIE_table_multiple_groupings.R

Defines functions BIFIE_table_multiple_groupings

## File Name: BIFIE_table_multiple_groupings.R
## File Version: 0.14

#- reidentify multiple grouping
BIFIE_table_multiple_groupings <- function( dfr, res00 )
{
    GR <- res00$GR
    if (GR>1){
        ind1 <- which( colnames(dfr)=="groupvar" )
        ind2 <- which( colnames(dfr)=="groupval" )
        N2 <- ncol(dfr)
        dfr1 <- dfr[, seq( 1, ind1 - 1 ), drop=FALSE ]
        for (gg in 1:GR){
            dfr1[, paste0("groupvar", gg ) ] <- paste(res00$group_orig[gg])
            ind <- match( dfr$groupval, res00$group_values)
            dfr1[, paste0("groupval", gg ) ] <- res00$group_values_recode[ ind,gg]
        }
        dfr <- cbind( dfr1, dfr[, seq( ind2 + 1, N2 ), drop=FALSE] )
    }
    return(dfr)
}

Try the BIFIEsurvey package in your browser

Any scripts or data that you put into this service are public.

BIFIEsurvey documentation built on May 29, 2024, 2:52 a.m.