have a look at ?formula and the examples
2011/9/8 Bos, Roger :
> I have a matrix called mat and y is the column number of my response and
> x is a vector of the column numbers of my terms. The variable name of y
> can change, so I don't want to hardcode it. I can find out the name as
> follows:
Sent: Thursday, September 08, 2011 9:22 AM
To: Bos, Roger
Cc: r-help@r-project.org
Subject: Re: [R] How to specify a variable name in the regression formula
without hard coding it
have a look at ?formula and the examples
2011/9/8 Bos, Roger :
> I have a matrix called mat and y is the column nu
On Sep 8, 2011, at 9:03 AM, Bos, Roger wrote:
I have a matrix called mat and y is the column number of my response
and
x is a vector of the column numbers of my terms. The variable name
of y
can change, so I don't want to hardcode it. I can find out the name
as
follows:
name
I have a matrix called mat and y is the column number of my response and
x is a vector of the column numbers of my terms. The variable name of y
can change, so I don't want to hardcode it. I can find out the name as
follows:
>names(mat)[y]
[1] "er12.l"
Then I can run the regression
4 matches
Mail list logo