[R] Rgui: workaround for hang from tseries and other packages using Fortran I/O

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Dec 12 20:29:42 CET 2007

Several people have reported hanging when using garch() from tseries under 
Rgui (Windows), as well as from other packages using Fortran I/O.

We will have a revised tseries that does not suffer from the problem 
shortly, but here is a generic workaround: set the environment variable
GFORTRAN_STDOUT_UNIT to -1 before running R (critically before using any 
package or module such as Lapack, BLAS ... that uses Fortran)
One simple way to do this is to have

if(.Platform$GUI == "Rgui") {
     Sys.setenv(GFORTRAN_STDOUT_UNIT = "-1")
     Sys.setenv(GFORTRAN_STDERR_UNIT = "-1")

in your ~/.Rprofile file.  The second line is not needed for tseries but 
could be needed for other programs.  This will be in R-devel and R-patched 

Note that Fortran output is still lost: this is just a palliative measure 
and the real fix for tseries generates the desired output.

(I had to read through the libgfortran to find this: it is confusing that 
Windows I/O is done by a file named unix.c!)

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list