Learn R Programming

rtemis (version 0.79)

dat2poly: Create n-degree polynomial from data frame

Description

This is a convenience function that will take each column of the input and calculate 1:degree powers and concatenate into a data.frame of dimensions `n * (degree * p)` given an `n * p` input

Usage

dat2poly(dat, method = c("simple", "poly"), degree = 2, raw = FALSE,
  as.data.frame = TRUE)

Arguments

dat

Numeric, matrix / data.frame: Input

method

String: "simple", "poly". "simple": raise each column of dat up to degree. "poly": use stats::poly with arguments degree and raw

degree

Integer: degree of polynomials to create. Default = 2

raw

Logical: If TRUE, create simple polynomial, not orthogonalized. Default = FALSE

as.data.frame

Logical: If TRUE, return data.frame. Default = TRUE