Ali Turab Lotia - 1 year ago 70

R Question

Is there a command that can return all significant interaction terms in R?

For example:

Input = c(age, gender,nationality)

output = list of significant interactions =

c(age * gender, gender * nationality, age * nationality * gender)

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

Try the `broom`

package:

```
library(broom)
m = lm(mpg ~ am * hp * disp, data = mtcars)
tidy.m = tidy(m)
tidy.m$term[tidy.m$p.value < 0.05]
```

Which gives you:

```
[1] "(Intercept)" "am" "am:disp" "am:hp:disp"
```

Is that what you want?

(This is assuming that the p value is the indicator of significance.)

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**