R/expandCol.R

Defines functions `expandCol`

`expandCol` <-
function(icol, mat, ncateg) {
        colName <- colnames(mat)[icol]
        colIndexes <- unlist(strsplit(colName,"\\."))
        indexCol <- as.integer(colIndexes[length(colIndexes)])
        if (indexCol < ncateg) {
                remRows <- (nr <- nrow(mat)) - indexCol
                result <- rbind(matrix(mat[1:indexCol,icol],nrow=indexCol,ncol=remRows), diag(remRows))
                colnames(result) <- paste(colName,as.character((indexCol+1):nr),sep=".")
        }
        else
                result <- NULL
        result
}

Try the goProfiles package in your browser

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

goProfiles documentation built on Nov. 8, 2020, 8:12 p.m.