R-beta: dataframes and function side effects

Jim Lindsey (jlindsey@luc.ac.be)
Tue, 17 Feb 1998 09:18:11 +0100 (MET)

From: Jim Lindsey <jlindsey@luc.ac.be>
Message-Id: <9802170818.AA21199@alpha.luc.ac.be>
Subject: R-beta: dataframes and function side effects
To: r-help@stat.math.ethz.ch (r-help)
Date: Tue, 17 Feb 1998 09:18:11 +0100 (MET)

I have a function that returns a dataframe. A second funtion calls the
first to obtain the dataframe, then attaches it to have access to the
column names. Lo and behold, this is done globally so that, after
running the second function a few times, I have all kinds of
dataframes attached giving all sorts of weird errors. If I put a
detach at the end of the second function, things are better, but
during debugging, if I ctrl-C while it is running (this is a random
effects Cox PH model, rather slow), I start accumulating dataframes
again. I suppose that if (some version of) S-Plus does the same thing,
this must be good stuff but it is a very annoying side effect of a
function to have dataframes attached globally and not locally.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch