[R] pls help to print out first row of terms(model) output in example program

2011-12-19 Thread Paul Johnson
Greetings. I've written a convenience function for multicollinearity diagnosis. I'd like to report to the user the formula that is used in a regression. I get output like this: mcDiagnose(m1) [1] The following auxiliary models are being estimated and returned in a list: [1] `x1` ~ .

Re: [R] pls help to print out first row of terms(model) output in example program

2011-12-19 Thread William Dunlap
Does applying formula() to the output of lm() (or terms()) do what you want? d - data.frame(y=1:10, x1=log(1:10), x2=sqrt(1:10), x3=1/(1:10)) formula(lm(formula(y~.), data=d)) # dot expanded y ~ x1 + x2 + x3 lm(formula(y~.), data=d)$call[[2]] # your original formula(y~.)