Skip to content
Prev 10701 / 398502 Next

Echoing commands (not using source())

...
But, this is why I asked in the first place. I want to be able to have a
function that works the same way as example("foo.R") but instead having the
example code living in a script file, it should be a function living in
memory.

In the long run, this will be used in my object oriented add on I am writing
for [R] (which works and it provides references!). One could then define a
static method called example(). With static classes, as in Java, the user
can write:

  MyClass$example()

which should run and show an example code. This should behave similar to
example("MyClass"), but as I started out, it would be nice if the code could
actually live inside same scope/environment and not have to be searched
which is the case when using example(). I'll stick with source()/example()
for now.

Henrik Bengtsson
MSc Computer Science
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._