Re: [R] Read code from character string

From: Johannes Huesing <johannes_at_huesing.name>
Date: Fri, 18 Jun 2010 08:16:45 +0200

Peter Langfelder <peter.langfelder_at_gmail.com> [Thu, Jun 17, 2010 at 09:38:45PM CEST]:
> eval(parse(text="print(9**2)"))

cheers, I overlooked the text option.

>
> On Thu, Jun 17, 2010 at 12:32 PM, Johannes Huesing
> <johannes_at_huesing.name> wrote:
> > Dear expRts,
> > I have a character string, say a <- "print(9**2)". How do I execute
> > the contents of the string, parsed as R code? Do I have to open a
> > connection and use cat(a), and parse it at the other end?

-- 
Johannes Hüsing               There is something fascinating about science. 
                              One gets such wholesale returns of conjecture 
mailto:johannes_at_huesing.name  from such a trifling investment of fact.                
http://derwisch.wikidot.com         (Mark Twain, "Life on the Mississippi")

______________________________________________
R-help_at_r-project.org 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.
Received on Fri 18 Jun 2010 - 06:19:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Jun 2010 - 15:00:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive