add_splines | R Documentation |
Adds spline terms calculated via Hmisc::rcspline.eval()
to a data frame.
add_splines(data, variable, knots = NULL, nk = 5, norm = 2, new_names = NULL)
data |
a data frame |
variable |
name of column in data |
knots |
knot locations. If not given, knots will be estimated using default
quantiles of |
nk |
number of knots. Default is 5. The minimum value is 3. |
norm |
‘0’ to use the terms as originally given by Devlin and
Weeks (1986), ‘1’ to normalize non-linear terms by the cube
of the spacing between the last two knots, ‘2’ to normalize by
the square of the spacing between the first and last knots (the
default). |
new_names |
Optionally specify names of new spline columns |
data frame
Knot locations are returned in attr(data[[variable]], "knots")
trial %>%
add_splines(age)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.