[R] Named pipe connections and stdout
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Mon Nov 26 11:25:43 CET 2001
Mark Myatt <mark at myatt.demon.co.uk> writes:
> All,
>
> I am trying to use a named pipe to steer R from an external application.
> Following the examples in RNEWS 1:1, I have created a simple listener:
>
> zz <- fifo("TESTFIFO", "r")
> repeat
>
> {
> a <- readLines(zz)
> if(length(a) != 0)
> {
> e <- try(eval(parse(text = a)))
> if (inherits(e, "try-error"))
> {
> # error handling code here
> cat("Error", "\n")
>
> }
> }
> }
>
>
>
> I tested this by steering R from a simple console (e.g. using something
> like:
>
> echo "<r-command> > TESTFIFO
>
> This works OK but where has stdout gone?
With eval() in a loop, wouldn't you need a print(e)?
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list