[R] Could concurrent R sessions mix up variables?

Anthony Damico ajdamico at gmail.com
Fri Dec 10 19:13:32 CET 2010

Hi, I'm working in R 2.11.1 x64 on Windows x86_64-pc-mingw32.

I'm experiencing a strange problem in R that I'm not even sure how to
begin to fix.

I've got a huge (forty-pages printed) simulation written in R that I'd
like to run multiple times.  When I open up R and run it on its own,
it works fine.  At the beginning of the program, there's a variable X
that I set to 1, 5, 10, 20, depending on how sensitive I want the
simulation to be to a certain parameter.  When I just run one instance
of R, the X variable stays the same throughout the program.

I have a quad-core machine, so I'd like to take advantage of all four

If I open up four sessions and set X to 1, 5, 10, and 20 in those
different sessions, then run all four simulations all the way through
(about eighteen hours of processing time) at the same time, the
variable X ends up being 20 at the end of all four sessions.  It's as
if R mixed up the variable setting between the four concurrent
sessions.  I can't figure out why else my variable X would ever get
changed to 20 in the three simulations that I set it to 1, 5, and 10,
respeectively (it doesn't get updated anywhere during the simulation).

When I have all four of these simulations running concurrently, I am
absolutely maxing out my computer.  All four processors are at 100%,
and my Windows Task Manager says I'm using almost 100% of my 16 GB of
RAM.  Is it possible that intense resource use would cause a variable
conflict like this?  I have no idea where to start troubleshooting
this error, so any advice would be appreciated.


Anthony Damico
Kaiser Family Foundation

More information about the R-help mailing list