all_interactions | R Documentation |
Generate a string with all interactions of a certain degree, to be used in a GAM formula
all_interactions(x, degree = 2)
x |
Character vector of variable names |
degree |
Maximum interaction degree |
A string looking like the right hand side of a GAM formula with tensor product interactions.
For example, if x
is c("x1","x2","x3")
, then all_interactions(x, degree=2)
should return
"te(x1,x2) + te(x1,x3) + te(x1,x3)"
x <- c("x1","x2","x3")
all_interactions(x, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.