Re: [R] Determining response variable in a formula

2005-07-12 Thread ronggui
is it what you want? >dat<-data.frame(x=rnorm(10),y=rnorm(10),z=rnorm(10)) > my.form <- as.formula(y ~ x + z) > my.form y ~ x + z > m<-model.frame(my.form,data=dat) > model.extract(m,"response") 1 2 3 4 5 6 7 -0.3434826 1.0145622 -0.4

Re: [R] Determining response variable in a formula

2005-07-12 Thread Sundar Dorai-Raj
David Kane wrote: > I have a formula from which I want to deduce the name of the response > variable. One way of doing so is as follows: > > >>my.form <- as.formula("y ~ x + z") >>all.vars(my.form)[1] > > [1] "y" > > > Is there a better way and/or preferrred method of determining "y" from >

[R] Determining response variable in a formula

2005-07-12 Thread David Kane
I have a formula from which I want to deduce the name of the response variable. One way of doing so is as follows: > my.form <- as.formula("y ~ x + z") > all.vars(my.form)[1] [1] "y" > Is there a better way and/or preferrred method of determining "y" from my.form than this one? In messing around