Re: [R] How to extract the variable names from a formula

2009-11-19 Thread Marc Schwartz
On Nov 19, 2009, at 9:28 PM, Yihui Xie wrote: Hi all, Suppose I have a formula: a = log(y) ~ x1 + I(x2^2) How can I extract the original variable names 'y', 'x1', 'x2' from this formula? Thanks a lot! Regards, Yihui > all.vars(a) [1] "y" "x1" "x2" See ?all.vars HTH, Marc Schwartz

[R] How to extract the variable names from a formula

2009-11-19 Thread Yihui Xie
Hi all, Suppose I have a formula: a = log(y) ~ x1 + I(x2^2) How can I extract the original variable names 'y', 'x1', 'x2' from this formula? Thanks a lot! Regards, Yihui -- Yihui Xie Phone: 515-294-6609 Web: http://yihui.name Department of Statistics, Iowa State University 3211 Snedecor Hall, A