[R] A easy way to write formula

hadley wickham h.wickham at gmail.com
Sun Jul 27 21:41:57 CEST 2008


On Sun, Jul 27, 2008 at 4:19 AM, Mark Difford <mark_difford at yahoo.co.uk> wrote:
>
> Hi Jinsong and Thierry,
>
>>> (x1 + x2 + x3) ^2 will give you the main effects and the interactions.
>
> Although it wasn't specifically requested it is perhaps important to note
> that (...)^2 doesn't expand to give _all_ interaction terms, only
> interactions to the second order, so the interaction term x1:x2:x3 will be
> missing, To get these, do
>
> (x1 + x2 + x3)^3

Or just

x1 * x2 * x3

Hadley


-- 
http://had.co.nz/



More information about the R-help mailing list