A couple of ways:
List.glm <- list()
for(i in 1:n) list.glm[[i]] <-glm(,,,)
OR
List.glm <- lapply(1:n, function(x) glm(,,,))
On Fri, Oct 9, 2009 at 7:54 AM, P.Branco <pjlbranco at yahoo.com>
wrote:>
> Hello,
>
> I am trying to run a for-loop in which I want to add glm output objects
> sequentially into a list. I do not know how to give names to each object in
> a list. I tried this :
>
>
> List.glm <- list()
>
> for(i in 1:n)
>
> list.glm <- list(list.glm, glm(,,,))
>
>
>
> but it is obviously unsuited?
>
> Best regards,
>
> Paulo
> --
> View this message in context:
http://www.nabble.com/Naming-objects-in-a-list-tp25819794p25819794.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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?