Instead of a loop you can use the replicate or lapply functions which
will create lists for you.

otherwise you can start with an empty list (mylist <- list() )

then add to the list in each iteration of the loop:

for(i in 1:10) {
    mylist[[i]] <- myfunction(i)
}



On Sat, Jun 30, 2012 at 1:34 PM, solafah bh <solafa...@yahoo.com> wrote:
> Hello
> I have a loop to sample 20 samples and I want to put them in one list, how I 
> can make this??
>
> Regards
> Sulafah
>         [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@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.
>



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

______________________________________________
R-help@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.

Reply via email to