Re: [R] execute r-code stored in a string variable

2011-08-02 Thread Samuel Le
Yes, you can use: eval(parse(text=c)) On the other hand I would not recommend to use c as a variable name as it is the name of a very important function in the R language to aggregate data. HTH, Samuel -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-projec

Re: [R] execute r-code stored in a string variable

2011-08-02 Thread Ista Zahn
Hi Kim, You can use eval(parse(text = c)) Best, Ista On Tue, Aug 2, 2011 at 8:22 AM, Kim Lillesøe wrote: > Dear all > > I have a simple R question. How do I execute R-code stored in a variable? > > E.g if I have a variable which contains some R-code: > c = "reg <- lm(sales$sales~sales$price)" >