[R] features of save and save.image (unexpected file sizes)

Vaidotas Zemlys mpiktas at gmail.com
Fri Feb 2 16:39:18 CET 2007


Hi,

On 2/2/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> On Fri, 2 Feb 2007, Vaidotas Zemlys wrote:
>
> > 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))
> > }
>
> You use no spaces around your operators or after commas.  R does when
> deparsing:
>
> > 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))
> }
>
> because it is (at least to old hands) much easier to read.
>
> IcanreadEnglishtextwithoutanyspacesbutIchoosenotto.Similarly,Rcode.Occasional
> spacesare evenharderto parse.
>

Sorry for that, it is an old bad habit of mine. I'll try to get rid of
it. Does anybody know, if ESS can do this automatically, besides
automatical identing?

Vaidotas Zemlys
--
Doctorate student, http://www.mif.vu.lt/katedros/eka/katedra/zemlys.php
Vilnius University



More information about the R-help mailing list