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<-(1:1000)### sequence parameter sink("prueba.txt") for (i in seq(z)) { P1<-read.csv("2R_EQ_P_R1.csv") P2<-read.csv("2R_EQ_P_R2.csv") c<-data.frame(P1[i],P2[i]) c.t<-ts(c)*-1 try(print(z[i])) try(SeoTest<-TVECM.SeoTest(c.t, lag=1, beta=1, trim=0.1, nboot=100)) 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.