[R] variable names in lm formula ~.

Vito M. R. Muggeo vito.muggeo at unipa.it
Tue Jan 30 12:11:56 CET 2018

dear all,
Is the following intentional? Am I missing anything in documentation?

d<-data.frame(y=rnorm(10,5,.5),exp=rnorm(10), age=rnorm(10))
formula(lm(exp(y)~exp+age, data=d))
#--> exp(y) ~ exp + age

formula(lm(exp(y)~., data=d))
#--> exp(y) ~ age

variable 'exp' (maybe indicating "experience") is not included in the 
model. The same happens with 'log' (and other function names, I suppose..)


Vito M.R. Muggeo
Dip.to Sc Econom, Az e Statistiche
Università di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 23895240
fax: 091 485726
Associate Editor, Statistical Modelling
Chair, Statistical Modelling Society

More information about the R-help mailing list