[R] apply formula to data?

ivo welch ivowel at gmail.com
Tue May 11 14:35:46 CEST 2010

dear R wizards---

I am looking for a reference that explains how to work with formula
objects.  for example, say, I have a formula which I want to use in an
NLS.  I want to test what this formula to see if my function was
defined correctly.  Is there a way to apply a formula to data?  For

   my.formula = (y ~ a+b*x^2)
   x= 1:10; a=2; b=3;
   computed.y= apply.a.formula( my.formula, x, a, b )

I know that this has issues, not the least of which is that a formula
may not return a y. and that  an lm() specification would require me
to infer that I have an implicit coefficient vector that is not even
specified (i.e., y~x really is y~a+b*x).  so, is there a reference to
formula objects somewhere?


Ivo Welch (ivo.welch at brown.edu, ivo.welch at gmail.com)

More information about the R-help mailing list