Thanks a lot for the answer, it works and really improves the speed of the  
loop.
Best,

Sergio René
El , Eik Vettorazzi <e.vettora...@uke.de> escribió:
> Hi Sergio,

> how about this:



> rm(list=setdiff(ls(),"z"))



> cheers.



> Am 20.10.2011 11:00, schrieb Sergio René Araujo Enciso:

> > Dear All:

> >

> > I would like to know if there is plausible way to say to R to remove all

> > elements in the memory but the sequence. I have a code which makes a  
> loop,

> > and what I want is after the programme has performed all the operation  
> over

> > every "i"th element, to remove all the objects, expect the sequence

> > parameter. I included the option "rm(list=ls(all=TRUE))", but obviously  
> that

> > removes the sequence as well. I know that I can give the names of the

> > objects to remove, but instead of doing so I would like to tell R  
> remove all

> > but the sequence. Is there a way for doing so? The reason for removing  
> all

> > the objects after each operation is saving some memory, as the  
> operation I

> > am doing involves some bootstrapping, after the loop reaches a  
> certain "i"th

> > element, the operations start to be really slow. So I want to faster the

> > loop by removing the objects and free memory after every operation.

> > Below is my code:

> >

> > setwd("C:\\Dokumente und Einstellung\\.....")

> > library("tsDyn")

> >

> > z
> > sink("prueba.txt")

> > for (i in seq(z))

> > {

> > P1
> > P2
> > c
> > ct
> > try(print(z[i]))

> > try(SeoTest
> > try(summary(SeoTest))

> > rm(list=ls(all=TRUE)) ### Here I want to erase all but "z"

> > }

> >

> > best,

> >

> > Sergio René

> >

> > [[alternative HTML version deleted]]

> >

> >

> >

> >

> > ______________________________________________

> > 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.





> --

> Eik Vettorazzi



> Department of Medical Biometry and Epidemiology

> University Medical Center Hamburg-Eppendorf



> Martinistr. 52

> 20246 Hamburg



> T ++49/40/7410-58243

> F ++49/40/7410-57790



> --

> Pflichtangaben gemäß Gesetz über elektronische Handelsregister und  
> Genossenschaftsregister sowie das Unternehmensregister (EHUG):



> Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen  
> Rechts; Gerichtsstand: Hamburg



> Vorstandsmitglieder: Prof. Dr. Guido Sauter (Vertreter des Vorsitzenden),  
> Dr. Alexander Kirstein, Joachim Prölß, Prof. Dr. Dr. Uwe Koch-Gromus





        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to