Re: [R] "Executing" a string

About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [R] "Executing" a string
From: Jan Goebel (jgoebel@diw.de)
Date: Wed 11 Oct 2000 - 22:51:14 EST


Message-ID: <20001011145114.A1923@diw14093.diw.de>

On Wed, 11 Oct 2000, Thomas Hoffmann wrote:

> In Matlab or Octave I can evaluate (evalf) the content of
> a string. In R I have looked around in the docs, but have not
> found a way to do something equivalent (which is possible, I think).
>
> Can anybody give me a pointer?
>

May be your looking for somethig like:

> example <- seq(0,5)
> string <- "example"
> as.name(string)
example
> eval(as.name(string))
[1] 0 1 2 3 4 5

Hope this helps

jan
-----------------------------------
Jan Goebel (mailto:jgoebel@diw.de)

DIW German Institute for Economic Research
SOEP
Königin-Luise-Str. 5
D-14195 Berlin
Germany

phone: 49 30 89789-377
-----------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Thu 01 Feb 2001 - 16:14:27 EST