[R] Updating a formula w a portion of another formula

Daniel Almirall dalmiral at umich.edu
Wed Dec 29 23:54:33 CET 2004


R-list,

Suppose I have

 oldfmla <- y ~ x

I would like to update it to  y ~ x + z  which I know I can get using

 newfmla <- update(oldfmla, ~ . + z)

However, what if I have

fmlatmp <- ~ z

Can I combine oldfmla and fmlatmp to get  y ~ x + z  some how?

Clearly,

 newfmla <- update(oldfmla, ~ . + fmlatmp)

will not work.

Thanks in advance,
Danny




More information about the R-help mailing list