[R] List arguments from data frame columns in formula

Gabor Grothendieck ggrothendieck at gmail.com
Tue Jan 12 15:57:42 CET 2010


Try this:

glm(y ~ ., family = binomial, data = data, ...)

On Tue, Jan 12, 2010 at 9:45 AM, npobedina <npobedina at gmail.com> wrote:
>
> Hi!
> I'm trying to run logistic regression on a dataset which is contained in
> dataframe "data" ("y" is in the first col, and 28 parameters for the model).
> How can I write formula for function `glm` without listing explicitly all 28
> paramaters?
> `glm(data[,1]~data[,2]+data[,3]+data[,4]+...,family=binomial)`
>
> As an option I can use `glm.fit(data[,-1],data[,1],family =
> binomial(link=logit))`. But the obtained object cannot be used in function
> `predict.glm`.
>
> Thanks,
> Natalia
> --
> View this message in context: http://n4.nabble.com/List-arguments-from-data-frame-columns-in-formula-tp1012146p1012146.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list