R/GetCMatrix_contrast.R

Defines functions GetCMatrix_contrast

GetCMatrix_contrast <- function(contrast_matrix, W, verbose) {

    if (is.vector(contrast_matrix)) {
        if (verbose) {
            message("contrast_matrix is a vector.")
        }
        if (length(contrast_matrix) != ncol(W)) {
            stop("But it should have length ", ncol(W), "!")
        } else {
            cmatrix <- matrix(contrast_matrix, nrow = 1)
        }
    } else if (is.matrix(contrast_matrix)) {
        if (verbose) {
            message("contrast_matrix is matrix.")
        }
        if (ncol(contrast_matrix) != ncol(W)) {
            stop("But it should have ", ncol(W), " columns!")
        } else {
            cmatrix = contrast_matrix
        }
    }

    return(cmatrix)
}

Try the TOAST package in your browser

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

TOAST documentation built on Nov. 8, 2020, 5:55 p.m.