[R-gui] problem with printing a question on R console afterplotting with JGR

Ian Fellows ifellows at ucsd.edu
Thu May 7 01:41:47 CEST 2009


Hi,

The problem has to do with the console output text buffer. If the display
text is too short it gets stuck in the buffer. I'm not sure what the most
appropriate solution is, though as a dirty work around you can pad your
output.

On my machine the following works:

useless2 <- function() {
   plot(pressure)
   cat(format(" do you see the plot?\n",width=120))
   answer <- readLines(n = 1)
}
useless2()




Ian

p.s. I've cc'ed a relevant list



-----Original Message-----
From: r-sig-gui-bounces at stat.math.ethz.ch
[mailto:r-sig-gui-bounces at stat.math.ethz.ch] On Behalf Of Etienne Laliberté
Sent: Tuesday, May 05, 2009 5:47 PM
To: r-sig-gui at stat.math.ethz.ch
Subject: [R-gui] problem with printing a question on R console afterplotting
with JGR

I'm using the JGR GUI on Ubuntu 9.04. The problem I'm running into is
best illustrated by the following two functions, which in theory
should be equivalent:

useless1 <- function() {
   plot(pressure)
   answer <- readline("do you see the plot?\n")
}

In JGR calling useless1() plots a graph, and at the same time a
question in the R console appears (hence I know what to answer).
However, with the following function:

useless2 <- function() {
   plot(pressure)
   cat("do you see the plot?\n")
   answer <- readLines(n = 1)
}


In JGR the plot appears but I don't see the question on the R console.
Only when I answer (without actually knowing what the question was!)
then the question appears.

This seems to be a problem with the JGR GUI, because I've never had
this problems with the Windows GUI or when running R directly from the
terminal. The problem is that some functions that I use frequently use
a similar approach than useless2() to ask interactive questions after
plotting.

Does anyone have an idea how to solve this problem (besides suggesting
another GUI)?

Many thanks,


--
Etienne Laliberté
================================
Rural Ecology Research Group
School of Forestry
University of Canterbury
Private Bag 4800
Christchurch 8140, New Zealand
Phone: +64 3 366 7001 ext. 8365
Fax: +64 3 364 2124
www.elaliberte.info

_______________________________________________
R-SIG-GUI mailing list
R-SIG-GUI at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-gui



More information about the R-SIG-GUI mailing list