all_interactions: Generate a string with all interactions of a certain degree,...

View source: R/evppi_gam.R

all_interactionsR Documentation

Generate a string with all interactions of a certain degree, to be used in a GAM formula

Description

Generate a string with all interactions of a certain degree, to be used in a GAM formula

Usage

all_interactions(x, degree = 2)

Arguments

x

Character vector of variable names

degree

Maximum interaction degree

Value

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)"

Examples

x <- c("x1","x2","x3")
all_interactions(x, 2)


voi documentation built on Sept. 17, 2024, 1:07 a.m.