[R] how to generate argument from a vector automatically

zhihua li lzhtom at hotmail.com
Tue Jul 12 11:53:14 CEST 2005

hi netters

i have a vector NAMES containing a series of variable names: 
i wanna fit a regression tree by using the code:  

but i don't want to type out "x+r+z+m+....+nn" one by one, as there are so 
many variables. besides, sometimes i wanna put the code in a function. so i 
need to have the argument "x+r+z+m+....+nn" generated from NAMES 

i've tried the code: paste(X,collpase="+") but it didn't work.

could anybody give me a hint?

More information about the R-help mailing list