[R] Multiple left hand side variables in a formula

Gabor Grothendieck ggrothendieck at gmail.com
Sat Mar 2 01:50:27 CET 2013


On Fri, Mar 1, 2013 at 7:16 PM, Frank Harrell <f.harrell at vanderbilt.edu> wrote:
> The lattice package uses special logic to allow for multiple left-hand-side
> variables in a formula, e.g. y1 + y2 ~ x.  Is there an elegant way to do
> this outside of lattice?  I'm trying to implement a data summarization
> function that logically takes multiple dependent variables.  The usual
> invocation of model.frame( ) causes R to try to do arithmetic addition to
> create a single dependent variable.
>

Try:

lm( cbind(Sepal.Length, Sepal.Width) ~., iris)

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list