This may not be the smoothest way to produce the result, but here is a
two-step solution:

first find the formula within the object created by the call to glm():

form <- qq["formula"] or equivalently form <- qq$formula

then apply the function all.vars() to the result, and return the first
element 

variables.in.formula <- all.vars(form)

variables.in.formula[1]  #  will be the response variable


leffgh wrote:
> 
> for example
> glm(a~b+c+d,data=eee)->qq
> 
> Is there a function able to return the name of the response variable?
> suppose "ff" is the function satisfying this need,
> ff(qq) then "a" (Not the value of a) will be returned.
> could you tell me which is the "ff" I am looking for ?
> 
> Thank you very much 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/a-very-easy-question%2C-how-to-extract-the-name-of-the-response-variable-tf4796264.html#a13722941
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org 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.

Reply via email to