I would like to find a command in R, in order to calculate all possible models for a given set of variables. For example, for three variables x1, x2 and x3 there are 8 possible models:
m1: x1+x2+x3
m2: x1*x2+x3
m3: x1*x3+x2
m4: x2*x3+x1
m5: x1*x2+x1*x3
m6: x1*x2+x2*x3
m7: x1*x3+x2*x3
m8: x1*x2*x3
If I have 5 variables there are 6894 different models (including all possible interaction) but I would like to confirm with R.