Hi, On 2/2/07, Prof Brian Ripley <[EMAIL PROTECTED]> 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 ______________________________________________ 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.