[R] Obtaining the variable names of a glm object

Pfaff, Bernhard Bernhard.Pfaff at drkw.com
Fri Nov 29 13:15:10 CET 2002


names(model$coef[1])

use integers in square brackets to adress the position of your lhs-variable,
is this what you want?

HTH
Bernhard

-----Original Message-----
From: Kenneth Roy Cabrera Torres
[mailto:krcabrer at perseus.unalmed.edu.co]
Sent: 29 November 2002 02:21
To: Phil Saunders
Cc: Kenneth Cabrera; R-help at stat.math.ethz.ch
Subject: RE: [R] Obtaining the variable names of a glm object




On Fri, 29 Nov 2002, Phil Saunders wrote:

> Is names(model1$coef) what you're looking for?

I know that I obtain the names, but I want to obtain them
separated, not in one string.
>
> -----Original Message-----
> From: Kenneth Cabrera [mailto:krcabrer at epm.net.co]
> Sent: 29 November 2002 10:36
> Cc: R-help at stat.math.ethz.ch
> Subject: [R] Obtaining the variable names of a glm object
>
>
>
> Hi, R users!
> Suppose I make a model like this:
>
>
model1<-glm(resp~var1+var2+factor1+factor2+var1:factor1+var1:factor1+var2:fa
ctor2+var2:factor2,family=poisson)
>
>
> where "resp" is a response variable (poisson distributed) "var1" and
"var2" are continuous variables and "factor1" and "factor2" are nominal
variables (here I use them as
> dummy variable)
> "factor1" has 2 levels (2 and 8)  and "factor2" 3 levels ( 1, 6 and 12).
Now I want to obtain the labels of the coeficients of the model in 3
> separate columns and a
> 4th column with the corresponding value,
>
> like this:
>
> variable1       variable2      level       value
> (intercept)                                  X
> var1                                         X
> var2                                         X
> factor1                            8         X
> factor2                            6         X
> factor2                           12         X
> var1                factor1        8         X
> var1                factor2        6         X
> var1                factor2       12         X
> var2                factor1        8         X
> var2                factor2        6         X
> var2                factor2       12         X
>
> If I use:
> model1$coef, I obtain the name of the coef, but joined.
> I want them separated.
>
> Thank you very much for your help!!!
>
> --
> Kenneth Roy Cabrera Torres
>
>
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
> r-help mailing list -- Read
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
>
> ________________________________________________________________________
> This email has been scanned for all viruses by the MessageLabs SkyScan
> service. For more information on a proactive anti-virus service working
> around the clock, around the globe, visit http://www.messagelabs.com
> ________________________________________________________________________
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
> r-help mailing list -- Read
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
>

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._


----------------------------------------------------------------------
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
----------------------------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list