Re: [R] need suggestion about building formual

From: Simple <qsb_at_nlbmol.ibp.ac.cn>
Date: Sun 02 Oct 2005 - 00:45:29 EST

Thanks for your kind respond. Although the answer didn't solve my question clearly,maybe I still not understand the art of R.

I'm sorry that I had not talked the problem clearly, maybe a example with more detail will be suitable as suggested in the the posting guide.  

In function fitting program, such as Sigmaplot, a fitting formula, can be write in separate form:
G=a+(b*x)^(1/2)
k=exp((G-G0)/(R*T))
fit k to y

of course,in R's nls, can write as:
mynls<-nls(formula=y~exp((a+(b*x)^(1/2)-G0)/(R*T)),data=mydata,...)

In this example, the formula is simple and acceptable. However, when the formula is more complexity,writing all in one formula,the readability will be damaged.So I'm looking for a way to write simple and readable code in this situation.   

Spencer Graves wrote:
> I'm not certain what you are asking.
>
> You can build expressions in R as character strings and then execute
> them. Example:
>
> expr <- paste("two <-", 1, "+", 1)
> eval(parse(text=expr))
> two
>
> If this does not answer your question, PLEASE do read the posting
> guide, "www.R-project.org/posting-guide.html". It can help increase the
> chances of a quick and useful reply.
>
> spencer graves
>
> Simple wrote:
> > hi,
> > I'm an newbie for R,I want do some fitting in R.
> >
> > I wander if it is possible to write a few of equations but only one
> > formual when fitting
> >
> > Currently,My problem is,in R, is there methods combination a few
> > equations into one formual?
> > For example,
> > y=f1(k);
> > k=f2(t);
> > t=f3(x);
> > although it is certain that the can be equations turn into one formual as
> > y~f(x),but write such a complexity string make me painful.
> >
> > I have searched the web and found out there were only examples with one
> > formual.any suggestion?
> >
> > I hope that I have omit something.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Oct 02 00:53:40 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:34 EST