Perhaps I'm dense, but huh*? -- Bert *e.g. What are you trying to do? R does it's own garbage collection -- why do you think you need it? And, as a general comment which may or may not be applicable, if you create variables in a function they are local only to the function -- they disappear once the function returns. But I'm not sure this is relevant to your query.
On Tue, Aug 28, 2012 at 11:29 AM, Sam Steingold <s...@gnu.org> wrote: > At the end of a for loop its variables are still present: > > for (i in 1:10) { > x <- vector(length=100000000) > } > ls() > > will print "i" and "x". > this means that at the end of the for loop body I have to write > > rm(x) > gc() > > is there a more elegant way to handle this? > > Thanks. > > -- > Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X > 11.0.11103000 > http://www.childpsy.net/ http://camera.org http://palestinefacts.org > http://iris.org.il http://www.PetitionOnline.com/tap12009/ > http://truepeace.org > Computers are like air conditioners: they don't work with open windows! > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.