[R] How to split the left and right hand terms of a formula

From: Daniel Gerlanc <dgerlanc_at_gmail.com>
Date: Thu 27 Jul 2006 - 05:04:00 EST


Hello All,

I've sent a few messages to the list regarding splitting a formula into its right and left hand terms. Thanks to everyone who has responded.

I believe that the best way to extract the left and right hand terms as character vectors follows:

library(nlme)

formula <- y ~ x + z

left.term <- all.vars(getResponseFormula(formula)) covariates <- all.vars(getCovariateFormula(formula))

Thanks!

Dan Gerlanc
Williams College



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. Received on Thu Jul 27 05:12:22 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 27 Jul 2006 - 06:16:17 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.