[R] String mathematical function to R-function

From: Cleber N.Borges <klebyn_at_yahoo.com.br>
Date: Sun 09 Jul 2006 - 07:29:10 EST

hello

I make a subroutine that give-me a (mathematical) function in string format.
I would like transform this string into function ( R function ).

thanks for any tips.
cleber

#e.g.
fun_String = "-100*x1 + 0*x2 + 100*x3"

fun <- function(x1,x2,x3){
return(
############

evaluation( fun_String )

############
)

True String mathematical function :-( :-(

> nomes
[1] "8.49*x1*z1 + 6.13*x1*z2 + 6.4*x1*z3 + 6.9*x2*z1 +

4.54*x2*z2 + 3.99*x2*z3 + 19.31*x3*z1 + 12.49*x3*z2 +
3.86*x3*z3 + 5.25*x1*z1*z2 + -6.2*x1*z1*z3 +
9.07*x1*z2*z3 + 10.87*x2*z1*z2 + 9.78*x2*z1*z3 +
49.05*x2*z2*z3 + 4.56*x1*x2*z1 + -4.9*x1*x2*z2 +
4.01*x1*x2*z3 + -0.39*x3*z1*z2 + 14.34*x3*z1*z3 +
0.7*x3*z2*z3 + -2.84*x1*x3*z1 + 20.25*x1*x3*z2 +
6.44*x1*x3*z3 + -4.91*x2*x3*z1 + 5.45*x2*x3*z2 +
37.99*x2*x3*z3 + -22.24*x1*z1*z2*z3 +
-97.41*x2*z1*z2*z3 + -8.67*x1*x2*z1*z2 +
49.14*x1*x2*z1*z3 + 14.24*x1*x2*z2*z3 +
282.71*x3*z1*z2*z3 + 34.83*x1*x3*z1*z2 +
111.2*x1*x3*z1*z3 + 101.38*x1*x3*z2*z3 +

-6.93*x2*x3*z1*z2 + 90.16*x2*x3*z1*z3 +
-9.11*x2*x3*z2*z3 + 17.22*x1*x2*x3*z1 +
-29.42*x1*x2*x3*z2 + -19.87*x1*x2*x3*z3 +
-277.41*x1*x2*z1*z2*z3 + -482.82*x1*x3*z1*z2*z3 +
-688.23*x2*x3*z1*z2*z3 + -588.4*x1*x2*x3*z1*z2 +
-197.31*x1*x2*x3*z1*z3 + -722.58*x1*x2*x3*z2*z3 +
5536.59*x1*x2*x3*z1*z2*z3"
>                 

o discador agora!



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 Jul 09 07:33:51 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 09 Jul 2006 - 10:16:31 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.