Forward slash interaction term in R

33 views Asked by At

I'm reading this vignette which states:

Most R users will be familiar with the base expansion operators for creating model interaction terms, e.g. x1*x2, x1:x2, and x1/x2

I know that x1:x2 is x1 multiplied by x2.

While x1*x2=x1+x2+x1:x2.

But I don't know what x1/x2 is, and I can't find useful information online.

What does the forward slash do in interaction term in R?

1

There are 1 answers

0
Seth On

The details section in the documentation for stats::formula provides a description for each operator, including /:

  • The / operator provides a shorthand, so that a / b is equivalent to a + b %in% a.