Re: [R] Character string to R object

2012-04-28 Thread Duncan Murdoch
On 12-04-28 10:37 AM, Ista Zahn wrote: Hi JN, You can use eval(parse(text = cstr)) for this. I've been told to avoid this when possible, though I'm not sure why. I would say to avoid it because it's hard to catch errors easy errors, and it can introduce difficult errors. Presumably cstr is

Re: [R] Character string to R object

2012-04-28 Thread John C Nash
Thanks Gabor and Ista, I should have realized I could tweak parse(), since I've been using it elsewhere. Somehow focused only on documentation of source(). JN On 04/28/2012 10:36 AM, Gabor Grothendieck wrote: On Sat, Apr 28, 2012 at 10:27 AM, John C Nash wrote: I've been creating some R t

Re: [R] Character string to R object

2012-04-28 Thread Ista Zahn
Hi JN, You can use eval(parse(text = cstr)) for this. I've been told to avoid this when possible, though I'm not sure why. Best, Ista On Sat, Apr 28, 2012 at 10:27 AM, John C Nash wrote: > I've been creating some R tools that manipulate objective functions for > optimization. In so doing, I c

Re: [R] Character string to R object

2012-04-28 Thread Gabor Grothendieck
On Sat, Apr 28, 2012 at 10:27 AM, John C Nash wrote: > I've been creating some R tools that manipulate objective functions for > optimization. In so doing, I create a character string with R code, and then > want to have it in my workspace. Currently -- and this works fine -- I write > the code ou