Hi, On 2/2/07, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
> > I found the culprit. I was parsing formulas in my code, and I saved > > them in that large object. So the environment came with saved > > formulas. Is there a nice way to say R: "please do not save the > > environments with the formulas, I do not need them?" > > No, but why create them that way? You could do > > mmodel <- as.formula(mmodel, env=.GlobalEnv) > Hm, but say I have some large object in .GlobalEnv, and I generate mmodel 10 different times and save the result as a list with length 10. Now if I try to save this list, R will save 10 different copies of .GlobalEnv together with aforementioned large object? > The R way is to create what you want, not fix up afterwards. > > (I find your code unreadable--spaces help a great deal, so am not sure if > I have understood it correctly.) > Hm, I copied this code directly from Emacs+ESS, maybe the mailer mangled something. What I want to do with this piece of code (I will repaste it here) testf<- function(formula) { mainform <- formula if(deparse(mainform[[3]][[1]])!="|") stop("invalid conditioning") mmodel <- substitute(y~x,list(y=mainform[[2]],x=mainform[[3]][[2]])) mmodel <- as.formula(mmodel) list(formula=list(main=mmodel)) } is to read formula with condition: formula(y~x|z) and construct formula formula(y~x) I looked for examples in code of coplot in library graphics and latticeParseFormula in library lattice. Vaidotas Zemlys -- Doctorate student, http://www.mif.vu.lt/katedros/eka/katedra/zemlys.php Vilnius University ______________________________________________ R-help@stat.math.ethz.ch 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.