R/design.column.R

design.column <-
function (a, name = "X") 
{
    if (is.numeric(a)) {
        A = matrix(a)
        colnames(A) = name
        return(A)
    }
    else {
        a = as.factor(a)
        if (length(levels(a)) == 1) 
            return(NULL)
        A = model.matrix(~a)[, -1, drop = FALSE]
        colnames(A) = paste(name, levels(a)[-1], sep = ".")
        return(A)
    }
}

Try the ruv package in your browser

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

ruv documentation built on Aug. 31, 2019, 1:04 a.m.