Displaying 1 result from an estimated 1 matches for "whateverthefirstofthevariablenamesis".
2004 Mar 24
6
First Variable in lm
Hi all,
I just cannot think of how to do it:
I want to take the first variable (column) of a data frame and regress
it against all other variables.
bla <- function (dat) {
reg <- lm(whateverthefirstofthevariablenamesis ~., data=dat)
return(reg)
}
What kind of function do I have to take instead of the
whateverthefirstofthevariablenamesis,
eval(), substitute(), get(), ...
to correctly compute this regression?
With lm(get(names(dat)[1] ~., data=dat) there are no errors, but the
first variable also shows...