Re: [R] extract indep vars from formula

2012-11-07 Thread Bert Gunter
...perhaps ?all.vars as in > form <- y~x+z > all.vars(form) [1] "y" "x" "z" > all.vars(form)[-1] [1] "x" "z" -- Bert On Wed, Nov 7, 2012 at 2:03 PM, Alexander Shenkin wrote: > Hello, > > I'm trying to extract the independent variables from a formula. The > closest I've been able to come,

Re: [R] extract indep vars from formula

2012-11-07 Thread Marc Schwartz
On Nov 7, 2012, at 4:03 PM, Alexander Shenkin wrote: > Hello, > > I'm trying to extract the independent variables from a formula. The > closest I've been able to come, aside from rolling my own, is the following: > >> a = y ~ b * x >> attr(terms(formula(a)),"variables") > > The reason I'm do

Re: [R] extract indep vars from formula

2012-11-07 Thread Ista Zahn
Hi, On Wed, Nov 7, 2012 at 5:03 PM, Alexander Shenkin wrote: > Hello, > > I'm trying to extract the independent variables from a formula. This is somewhat ambiguous. Do you want the actual columns of values? The quoted variable names? Including the interaction term or not? If you just want the q

[R] extract indep vars from formula

2012-11-07 Thread Alexander Shenkin
Hello, I'm trying to extract the independent variables from a formula. The closest I've been able to come, aside from rolling my own, is the following: > a = y ~ b * x > attr(terms(formula(a)),"variables") The reason I'm doing this is that I'm building a grid of points that I use to construct a