tags:

views:

106

answers:

2

Hi,

is there a way to pass commands (from a shell) to an all ready running R-runtime/R-Gui, without copy&past. So far I only know how to call R via shell with the -f or -e option, but in both cases a new R-Runtime will process the R-Script or R-Command I passed to it. I rather would like to have an open R-Runtime waiting for commands passed to it (via what ever connection is possible).

regrads, Tiny

A: 

You can use Rterm (under C:\Program Files\R\R-2.10.1\bin in Windows and R version 2.10.1). Or you can start R from the shell typing "R" (if the shell does not recognize the command you need to modify your path).

teucer
Sorry, but I think you missunderstood my question. I know I can call R-Runtime from shell, but thats not the point. The point is I want to call "R -e 'a <- 3'" and next time "R -e 'print(a)'". Like this it will now work since both commands will have thier own R-Runtime so that the second command will through an Error "object 'a' not found"
+5  A: 

What you ask for cannot be done. R is single threaded and has a single REPL aka Read-eval-print loop which is, say, attached to a single input as e.g. the console in the GUI, or stdin if you pipe into R. But never two.

Unless you use something else as e.g. the most excellent Rserve which (when hosted on an OS other than Windoze) can handle multiple concurrent requests over tcp/ip. You may however have to write your custom connection. Examples for Java, C++ and R exist in the Rserve documentation.

Dirk Eddelbuettel
I didn't want to have two seperat connection to one R-Runtime. I was looking to use one connection at two seperat occasion.But Rserve looks quite like what I was looking for. But I'll have too look more closer into it.