[R] Is it a "Headless problem"? - Same code runs well in interactive R shell, but never terminates with Rscript

Asis Hallab asis.hallab at gmail.com
Fri May 3 17:26:50 CEST 2013


Dear R-Experts,

I seem to be dealing with a so called "headless" problem in R.

I wrote a quite extensive program that generates a Bayesian network
from a query protein's Phylogenetic Tree and subsequently uses a
message passing algorithm to infer the most likely annotation for the
query leaf in the tree using the other leaves known -and proven-
protein function annotations.

The program uses the following libraries:
library(tools)
library(Biostrings)
library(RCurl)
library(stringr)
library(ape)
library(gRain)             # gRain implements the message passing algorithm
library(RMySQL)
library(XML)
library(parallel)
library(brew)
library(xtable)

When the program is run from the command line as:
Rscript prog.r inp.file
with certain input data "inp" it gets stuck and does not terminate
ever. Memory usage sky-rockets and the process spends almost all of
its time on system calls.

Using the identical R code inside an interactive R shell with the very
same input data "inp" the script does not have any problems and
finishes actually amazingly fast.

I am flabbergasted and do require help.
Hence my questions:

* Is anything known about a problem similar to mine appearing when
using the above libraries?

* What is the difference -aside from the obvious missing
interactiveness- between running the very same R code inside an
interactive R shell or inside a file as an argument to Rscript?

* Does my problem indeed fall into the "headless" category?

The problem occurs in
R version 2.15.2 (2012-10-26) -- "Trick or Treat"
on Debian 6.0.2
uname -or gives
3.2.0-0.bpo.3-amd64 GNU/Linux

Any help will be much appreciated.
Have a pleasant day!



More information about the R-help mailing list