[R] repeating the same variable in formula

Rui Barradas ruipb@rr@d@@ @ending from @@po@pt
Mon Dec 10 11:26:57 CET 2018


Hello,

The formulas

y ~ cholesterol + age + age

and

y ~ cholesterol + age

are the same formula.
If you want 'age' twice, maybe

g <- y ~ cholesterol + I(age + age)
attr(terms(g), "term.labels")
#[1] "cholesterol"  "I(age + age)"


Hope this helps,

Rui Barradas

Às 06:49 de 10/12/2018, Subirana Cachinero, Isaac escreveu:
> y ~ cholesterol + age + age



More information about the R-help mailing list