R/compact.data.frame.R

Defines functions compact.data.frame

Documented in compact.data.frame

compact.data.frame <-
function (full.frame) 
{
    full.frame <- full.frame[order(full.frame$cn), ]
    full.frame.mod <- do.call(
        rbind.data.frame,
        split(x = full.frame$posterior, f = full.frame$subject))
    rownames(full.frame.mod) <- levels(full.frame$subject)
    names(full.frame.mod) <- paste("P", c(1:(dim(full.frame.mod)[2])), 
        sep = "")
    full.frame.mod$cn <- apply(full.frame.mod, FUN = which.max, 
        MARGIN = 1)
    full.frame.mod$subject <- row.names(full.frame.mod)
    full.frame <- subset(full.frame[, c("subject", "batch", "signal", 
        "trait")], full.frame$cn == 1)
    full.frame <- merge(full.frame, full.frame.mod)
    return(full.frame)
}

Try the CNVtools package in your browser

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

CNVtools documentation built on May 2, 2018, 2:15 a.m.