R/makeVector.R

makeVector <- function (x) 
{
    d <- dim(x)
    if (is.null(d)) 
        return(x)
    nn <- NULL
    if (d[1] == 1) {
        nn <- colnames(x)
    }
    else if (d[2] == 1) {
        nn <- rownames(x)
    }
    dim(x) <- NULL
    if (!is.null(nn)) 
        names(x) <- nn
    if ((!is.vector(x)) && (is.list(x))) 
        x <- unlist(x)
    x
}
zhangh12/ARTP2 documentation built on Aug. 16, 2019, 7:27 p.m.