Skip to content
Prev 314327 / 398503 Next

R crashing inconsistently within for loops

Steve Powers <powers_s <at> nd.edu> writes:
All of the advice given so far is useful (I think), but I thought I would
chime in and answer one of your questions, which is that this is indeed
surprising, especially if you're using only base packages.  I and many
other people routinely run thousands of iterations of these types of
analyses with no problem.  If (as Brian Ripley suggested) "crash" just
means that some of your scripts stop with errors in some cases, then
that's *not* surprising -- there are lots of ways to get glm() and gls()
to give errors with slightly weird data sets.  However, having R actually
crash (i.e. the whole R session 'terminates abnormally', in the words
of the posting guide) is quite a bit more unusual, and (if you are only
using base R, not any contributed packages that may call compiled code
in bad ways [or calling your own compiled code]) *always* constitutes
a bug.  Nondeterministic behavior in a deterministic function (i.e.
no random number generation) is also unusual/surprising.

 The key here is finding a reproducible example, which can be tough
for these kinds of problems.  But it sounds like you have one, so
if you can trim it down to a manageable size
 (see http://tinyurl.com/reproducible-000 for tips on creating
reproducible examples), and give full information about your system
(as suggested by another poster), this would be of great interest,
especially to the people who hang out on r-devel at r-project.org .
My prior probabilities are fairly strongly on the problem being
something flaky about your system, but helping to identify these
kinds of bugs in R is a community service ...