[R] quick way to construct formula

Luke jyzz88 at gmail.com
Wed Jun 29 04:48:34 CEST 2005


Dear R users,

I have a data with 1000 variables named "x1", "x2", ..., "x1000", and
I want to construct a formula like this format:

~x1+x2+...+x1000+x1:x2+x1:x3+x999:x1000+log(x1)+...+log(x1000)

That is: the base variables followed by all interaction terms and all
base feature log-transformations. I know I can use several paste
functions to construct it. But is there any other handy way to do it?

-Luke




More information about the R-help mailing list