Names not conforming to the usual R syntax can be placed in backquotes: > `log(x)` <- 1:10 > lm(`log(x)` ~ 1)
Call: lm(formula = `log(x)` ~ 1) Coefficients: (Intercept) 5.5 On Nov 28, 2007 9:52 AM, vito muggeo <[EMAIL PROTECTED]> wrote: > Dear all, > I have the following (rather) strange problem.. > For some reasons, I finally work with a variable whose name includes an > R function, "a.log(z)", say. And that is a problem when I call it in a > formula, for instance: > > > myname<-"a.log(z)" > > dd<-data.frame("a.log(z)"=1:10,y=rnorm(10)) > > o<-lm(y~1,data=dd) > > fo<-as.formula(paste(".~.+",paste(myname, collapse = "+"))) > > fo > . ~ . + a.log(z) > > update(o,formula=fo) > Error in eval(expr, envir, enclos) : could not find function "a.log" > > > > How can fit the model? namely how can I use "a.log(z)" in the example above? > > Many thanks, > vito > > > -- > ==================================== > Vito M.R. Muggeo > Dip.to Sc Statist e Matem `Vianelli' > Università di Palermo > viale delle Scienze, edificio 13 > 90128 Palermo - ITALY > tel: 091 6626240 > fax: 091 485726/485612 > > ______________________________________________ > 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. > ______________________________________________ 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.