Re: [R] Communicating with R through a named pipe: display refresh problem

From: Parker Jones <zoubidoo_at_hotmail.com>
Date: Wed, 23 Jan 2008 03:33:01 +1200

> Rather, non-interactive R does not run an event loop. The usual way
> around this is to use a pty, as R run from a pty is considered to be
> interactive.
>
> (Whether a fifo and a named pipe are the same concept is moot: some OSes
> have one and not the other.)
>
> The plan is to use threads in due course to handle X11 events.
>
I agree threads is the way to go.

In the meantime, I also tried a looping server which doesn't block on reads to a pipe. This still doesn't refresh the display but if R has a command to refresh the display then that will probably solve the problem.

# based on http://tolstoy.newcastle.edu.au/R/help/01c/2886.html stream <- fifo("R_pipe", "r", blocking=FALSE,) repeat
 {
  a <- readLines(stream)
  if(length(a) != 0)
   {
    e <- try(eval(parse(text = a)))
    if (inherits(e, "try-error"))

     {
      # error handling code here
      cat("Error", "\n")
     }

   }
 }

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 Tue 22 Jan 2008 - 15:35:39 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 Tue 22 Jan 2008 - 16:30:10 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