code_poly | R Documentation |
Takes a data frame, name of predictor variable, and polynomial order. Creates polynomial-transformed predictor variables, adds them to the data frame and returns the result. Original data frame is unchanged, remember to assign the result.
code_poly(df = NULL, predictor = NULL, poly.order = NULL,
orthogonal = TRUE, draw.poly = TRUE)
df |
data frame, should not contain any variables called "predictor" |
predictor |
string name of predictor variable |
poly.order |
integer order of polynomial to be created |
orthogonal |
logical value indicating whether polynomial should be orthogonal (default) or natural (aka raw) |
draw.poly |
logical value indicating whether to create a graph showing tranformed polynomial predictor values, defaults to TRUE |
Returns a data frame containing the original data and at least two new columns: "predictor".Index, and a column for each order of the polynomial-transformed predictor
WordLearnEx.gca <- code_poly(df=WordLearnEx, predictor="Block", poly.order=2)
Az.gca <- code_poly(df=Az, predictor="Time", poly.order=2, orthogonal=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.