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
}
brentonk/polywog documentation built on June 11, 2025, 3:51 a.m.