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 3-d model prediction surface in rgl.  If there are
more than two independent variables, I need to set the other ones to 0
in the dataframe for the predict() routine.  In order to do that, I need
to know what those variables are.

I suspect there's a better way to go about doing what I'm doing (perhaps
using the model.* family of functions).  But, in the meantime, just
extracting the independent variables will move me forward.

Thanks,
Allie

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to