R/expandMatrix.r

Defines functions expandMatrix

##
## Compute the polynomial expansion of a matrix, according to the specified
## `polyTerms` object
##
expandMatrix <- function(X, polyTerms, intercept = FALSE)
{
    ans <- computeExpandMatrix(X = X, poly_terms = polyTerms)
    rownames(ans) <- rownames(X)
    colnames(ans) <- rownames(polyTerms)
    if (intercept)
        ans <- cbind("(Intercept)" = 1L, ans)
    ans
}

Try the polywog package in your browser

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

polywog documentation built on May 1, 2019, 9:15 p.m.