Transforming a string into a command
David, Did my reply get orphaned or are you trying to help me realize that asking why something does not work is not a straightforward question? I'll try to cover both bases. I'll focus just on the first case that I don't understand. Suppose we have s<- "ln(a+b)" a<-1 b<-2 eval(parse(text=s)) Error in eval(expr, envir, enclos) : could not find function "ln" Perhaps it's because I don't understand eval well (any good references for reading up on eval, parse, substitute, etc.?). But I expected it to produce the same as the following line: eval(parse(text="ln(a+b)")) Xu David Winsemius wrote
On Nov 29, 2011, at 2:00 AM, Xu Wang wrote:
Why don't the following two commands work? eval(parse(text=s)) eval(as.expression(s))
Can you think of anything else we might need to know in order to answer that question? -- David Winsemius, MD West Hartford, CT
______________________________________________ R-help@ 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.
-- View this message in context: http://r.789695.n4.nabble.com/Transforming-a-string-into-a-command-tp4112183p4118294.html Sent from the R help mailing list archive at Nabble.com.