Re: [R] Transforming a string into a command

2011-11-29 Thread Petr PIKAL
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)) Hm, try to set an object s before calling. Regards Petr __ R-help@r-project.org mailing list

Re: [R] Transforming a string into a command

2011-11-29 Thread Xu Wang
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

Re: [R] Transforming a string into a command

2011-11-29 Thread Petr PIKAL
Hi 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

Re: [R] Transforming a string into a command

2011-11-29 Thread Jim Lemon
On 11/29/2011 06:30 PM, Xu Wang wrote: 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-

Re: [R] Transforming a string into a command

2011-11-29 Thread David Winsemius
On Nov 29, 2011, at 2:30 AM, Xu Wang wrote: David, Did my reply get orphaned All replies are orphaned. You are asked to include context if your question relies on code that has previously been posted. or are you trying to help me realize that asking why something does not work is not

Re: [R] Transforming a string into a command

2011-11-29 Thread Xu Wang
Petr, thanks for pointing that out. Jim, you are exactly right! Thank you for catching that. I did not realize in the other replies that they were using log and not ln. David, thank you for the lessons. I will improve my question asking skills. Thanks to all, Xu On Tue, Nov 29, 2011 at 9:31

Re: [R] Transforming a string into a command

2011-11-28 Thread Xu Wang
Why don't the following two commands work? eval(parse(text=s)) eval(as.expression(s)) -- View this message in context: http://r.789695.n4.nabble.com/Transforming-a-string-into-a-command-tp4112183p4118243.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Transforming a string into a command

2011-11-28 Thread David Winsemius
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] Transforming a string into a command

2011-11-27 Thread Victor
I would like to make a string executable, e.g, s- ln(a+b) a-1 b-2 execute string s to obtain ln(a+b) How can I make it? Ciao fron Rome Vittorio __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Transforming a string into a command

2011-11-27 Thread Michael Kao
This is one way to do it. a = 1 b = 2 c = parse(text = log(a + b)) eval(c) Hope this helps. Cheers, On 27/11/2011 11:16 a.m., Victor wrote: I would like to make a string executable, e.g, s- ln(a+b) a-1 b-2 execute string s to obtain ln(a+b) How can I make it? Ciao fron Rome

Re: [R] Transforming a string into a command

2011-11-27 Thread andrija djurovic
?eval s- expression(log(a+b)) a-1 b-2 eval(s) Andrija On Sun, Nov 27, 2011 at 11:16 AM, Victor vdem...@gmail.com wrote: I would like to make a string executable, e.g, s- ln(a+b) a-1 b-2 execute string s to obtain ln(a+b) How can I make it? Ciao fron Rome Vittorio