View source: R/polypoly-package.R
poly_add_columns | R Documentation |
Add orthogonal polynomial columns to a dataframe
poly_add_columns( .data, .col, degree = 1, prefix = NULL, scale_width = NULL, na_values = c("error", "warn", "allow") )
.data |
a dataframe |
.col |
a bare column name |
degree |
number of polynomial terms to add to the dataframe |
prefix |
prefix for the names to add to the dataframe. default is the
name of |
scale_width |
optionally rescale the dataframe using |
na_values |
How to handle missing values. Default is |
the dataframe with additional columns of orthogonal polynomial terms
of .col
df <- data.frame(time = rep(1:5, 3), y = rnorm(15)) # adds columns "time1", "time2", "time3" poly_add_columns(df, time, degree = 3) # adds columns "t1", "t2", "t3 and rescale poly_add_columns(df, time, degree = 3, prefix = "t", scale_width = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.