Re: [R] Equation as a character string

2012-03-15 Thread Gabor Grothendieck
On Thu, Mar 15, 2012 at 12:58 PM, Rui Barradas wrote: > Hello, > >> >> Hi Emily, >> >> Yes (see below), but you might be better off by writing a simple >> function.  Here are examples both ways (usually eval parse is highly >> discouraged). >> >> Cheers, >> >> Josh >> > > Yes, eval/parse is discou

Re: [R] Equation as a character string

2012-03-15 Thread Rui Barradas
Hello, > > Hi Emily, > > Yes (see below), but you might be better off by writing a simple > function. Here are examples both ways (usually eval parse is highly > discouraged). > > Cheers, > > Josh > Yes, eval/parse is discouraged but there's a way of using it, that is less troublesome, to c

Re: [R] Equation as a character string

2012-03-15 Thread Joshua Wiley
Hi Emily, Yes (see below), but you might be better off by writing a simple function. Here are examples both ways (usually eval parse is highly discouraged). Cheers, Josh # eqn1string <- "x^2 + x + 5" x <- 6 ## works eval(parse(text = eqn1string)) ## better f <- functio