R/postunstack.R

Defines functions postunstack

Documented in postunstack

postunstack <- function(x, form, ...) {
    stkout <- unstack(x, form, ...)
    if (!is.data.frame(stkout)) {
        sizes <- sapply(stkout, length)
        maxsize <- max(sizes)
        for (k in 1:length(sizes)) {
            stkout[[k]] <- c(stkout[[k]], rep(NA, maxsize - sizes[k]))
        } 
        stkout <- as.data.frame(stkout)
    }
    return(stkout)
}

Try the MPV package in your browser

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

MPV documentation built on April 14, 2025, 9:07 a.m.