R/mat2list.R

Defines functions mat2list

Documented in mat2list

mat2list <-
function(x, MARGIN=1)
{
    n <- dim(x)[MARGIN]
    if (MARGIN==1) {
        out <- lapply(1:n, function(z) x[z,])
        names(out) <- rownames(x)
    } else {
        out <- lapply(1:n, function(z) x[,z])
        names(out) <- colnames(x)
    }
    out
}

Try the mefa package in your browser

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

mefa documentation built on Oct. 7, 2021, 9:11 a.m.